utils

package
v0.6.5-ga.1 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2018 License: MIT Imports: 19 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) gin.HandlerFunc

Set MDB & ES 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 IsEmpty

func IsEmpty(s []string) bool

true if every string in given slice is empty

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 RecoveryMiddleware

func RecoveryMiddleware() gin.HandlerFunc

Recover with error

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