utils

package
v0.0.5-28 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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) gin.HandlerFunc

Set MDB in context.

func ErrorHandlingMiddleware

func ErrorHandlingMiddleware() gin.HandlerFunc

Handle all errors

func InClause

func InClause(prefix string, list []string) string

func InitConfig

func InitConfig(cfgFile string, cfgPath string) error

func LoggerMiddleware

func LoggerMiddleware() gin.HandlerFunc

func MaxInt

func MaxInt(x, y int) int

func MinInt

func MinInt(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 StringInSlice

func StringInSlice(a string, list []string) bool

func ToInterfaceSlice

func ToInterfaceSlice(s interface{}) []interface{}

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