utils

package
v0.0.5-37 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PROFILE = make(map[string]*ProfileData)
View Source
var PROFILE_MUTEX = sync.Mutex{}

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 Filter

func Filter(ss []string, test func(string) bool) []string

func InClause

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

func InitConfig

func InitConfig(cfgFile string, cfgPath string) error

func Int64InSlice

func Int64InSlice(a int64, list []int64) (ret bool)

func IntersectSorted

func IntersectSorted(first []string, second []string) (ret []string)

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 NullStringSliceToStringSlice

func NullStringSliceToStringSlice(in []sql.NullString) []string

func PrintProfile

func PrintProfile(reset bool)

func Profile

func Profile(name string, duration time.Duration)

func RecoveryMiddleware

func RecoveryMiddleware() gin.HandlerFunc

Recover with error

func StringInSlice

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

func ToInterfaceSlice

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

func UnionSorted

func UnionSorted(first []string, second []string) (ret []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 ProfileData

type ProfileData struct {
	Name     string
	Count    int
	Duration time.Duration
}

Jump to

Keyboard shortcuts

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