utils

package
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2019 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MDB_TO_GO = reverseLanguages()

Functions

func BindErrorMessage

func BindErrorMessage(err error) string

func ConvertArgsInt64

func ConvertArgsInt64(args []int64) []interface{}

func ConvertArgsString

func ConvertArgsString(args []string) []interface{}

func DataStoresMiddleware

func DataStoresMiddleware(mbdDB *sql.DB, esc *elastic.Client, logger, cm interface{}) gin.HandlerFunc

Set MDB, ES & LOGGER clients in context

func DetectLanguage

func DetectLanguage(text string, interfaceLanguage string, acceptLanguage string, uiOrder []string) []string

func ErrorHandlingMiddleware

func ErrorHandlingMiddleware() gin.HandlerFunc

Handle all errors

func GenerateName added in v1.1.7

func GenerateName(n int) string

func GenerateUID added in v1.1.7

func GenerateUID(n int) string

func InitConfig

func InitConfig(cfgFile string, cfgPath string) error

func Int64InSlice added in v0.6.9

func Int64InSlice(i int64, s []int64) bool

func IsEmpty

func IsEmpty(s []string) bool

true if every string in given slice is empty

func Join added in v0.7.8

func Join(l []interface{}, separator string) string

func LogError added in v0.9.0

func LogError(err error)

func LogRequestError added in v0.9.0

func LogRequestError(r *http.Request, err error)

func LoggerMiddleware added in v0.7.8

func LoggerMiddleware() gin.HandlerFunc

func MaxInt added in v1.1.1

func MaxInt(x, y int) int

Like math.Max for int

func Min

func Min(x, y int) int

Like math.Min for int

func MinInt added in v1.2.4

func MinInt(x, y int) int

Like math.Min for int

func Must

func Must(err error)

panic if err != nil

func Pprint added in v0.7.1

func Pprint(l interface{}) string

func PrintMap added in v0.7.8

func PrintMap(m interface{}) (string, error)

func RecoveryMiddleware

func RecoveryMiddleware() gin.HandlerFunc

Recover with error

func ResolveHost added in v0.9.7

func ResolveHost(c *gin.Context) (host string)

func ResolveScheme added in v0.9.7

func ResolveScheme(c *gin.Context) string

func ValidationErrorMessage

func ValidationErrorMessage(e *validator.FieldError) string

Types

type Date

type Date struct {
	time.Time
}

A time.Time like structure with date part only JSON marshalling

func (*Date) MarshalJSON

func (d *Date) MarshalJSON() ([]byte, error)

func (*Date) Scan

func (d *Date) Scan(value interface{}) error

func (*Date) UnmarshalJSON

func (d *Date) UnmarshalJSON(b []byte) error

type TestDBManager added in v1.1.7

type TestDBManager struct {
	DB *sql.DB
	// contains filtered or unexported fields
}

func (*TestDBManager) DestroyTestDB added in v1.1.7

func (m *TestDBManager) DestroyTestDB() error

func (*TestDBManager) InitTestDB added in v1.1.7

func (m *TestDBManager) InitTestDB() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL