utils

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2018 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertArgsInt64

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

func ConvertArgsString

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

func EnvironmentMiddleware

func EnvironmentMiddleware(mbdDB *sql.DB, backendUrls []string, publicOnly bool) gin.HandlerFunc

Set required resources for handlers in context

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 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

Types

type HttpError

type HttpError struct {
	Code int
	Err  error
	Type gin.ErrorType
}

func NewBadRequestError

func NewBadRequestError(err error) *HttpError

func NewHttpError

func NewHttpError(code int, err error, t gin.ErrorType) *HttpError

func NewInternalError

func NewInternalError(err error) *HttpError

func NewNotFoundError

func NewNotFoundError() *HttpError

func (HttpError) Abort

func (e HttpError) Abort(c *gin.Context)

func (HttpError) Error

func (e HttpError) Error() string

Jump to

Keyboard shortcuts

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