ginutils

package
v0.0.0-...-e46cadb Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2019 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrLayout 错误格式
	ErrLayout = "value=[%v] is not compatiable with [%s]'s validation tag [%s]"
)

Variables

This section is empty.

Functions

func BindCustomValidator

func BindCustomValidator(validationFuncs ...CustomValidationFunc)

BindCustomValidator ...

func CORS

func CORS() gin.HandlerFunc

CORS middleware

func HdlValidationErrors

func HdlValidationErrors(err error) error

HdlValidationErrors ... 帮助处理gin框架的表单校验异常信息

func LogRequest

func LogRequest(Logger *logger.Entity, logResponse bool) gin.HandlerFunc

LogRequest is a middleware to log each request

func Recovery

func Recovery(out io.Writer) gin.HandlerFunc

Recovery is a middleware to record each panic into file usage like:

gin.Engine.Use(Recovery(*os.File))

func RecoveryWithWriter

func RecoveryWithWriter(out io.Writer) gin.HandlerFunc

RecoveryWithWriter returns a middleware for a given writer that recovers from any panics and writes a 500 if there was one.

Types

type CustomValidationFunc

type CustomValidationFunc struct {
	Name string
	Func validator.Func
}

CustomValidationFunc ...

type FormValidationErrors

type FormValidationErrors struct {
	// contains filtered or unexported fields
}

FormValidationErrors ...

func (FormValidationErrors) Error

func (f FormValidationErrors) Error() string

Jump to

Keyboard shortcuts

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