utils

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2018 License: MIT Imports: 20 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 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 Max

func Max(x, y uint16) uint16

Like math.Min for int

func Min

func Min(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

Jump to

Keyboard shortcuts

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