Documentation ¶
Index ¶
- Constants
- func BindCustomValidator(validationFuncs ...CustomValidationFunc)
- func CORS() gin.HandlerFunc
- func HdlValidationErrors(err error) error
- func LogRequest(Logger *logger.Entity, logResponse bool) gin.HandlerFunc
- func Recovery(out io.Writer) gin.HandlerFunc
- func RecoveryWithWriter(out io.Writer) gin.HandlerFunc
- type CustomValidationFunc
- type FormValidationErrors
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 HdlValidationErrors ¶
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 ¶
CustomValidationFunc ...
type FormValidationErrors ¶
type FormValidationErrors struct {
// contains filtered or unexported fields
}
FormValidationErrors ...
func (FormValidationErrors) Error ¶
func (f FormValidationErrors) Error() string
Click to show internal directories.
Click to hide internal directories.