Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BindErrors ¶
type BindErrors struct {
// contains filtered or unexported fields
}
func New ¶
func New(errors error, messages map[string]map[string]error) *BindErrors
errors gin build error messages are custom error messages
type Person struct { Email `form:"email" binding:"required,email"` Password `form:"password" binding:"required,min=8"` }
var messages = map[string]map[string]error{ "Email":{ "required":errors.New("error"), "email":errors.New("error"), }, "Password":{ "required":errors.New("error"), "min":errors.New("error"), }, }
func (*BindErrors) FirstError ¶
func (be *BindErrors) FirstError() error
FirstError return the first error
func (*BindErrors) GetFiledErrors ¶ added in v0.0.2
func (be *BindErrors) GetFiledErrors(field string) []error
GetErrors return all errors of the field
func (*BindErrors) GetTagError ¶ added in v0.0.2
func (be *BindErrors) GetTagError(field, tag string) error
GetError return error based on field and tag
func (*BindErrors) LastError ¶
func (be *BindErrors) LastError() error
LastError return the last error
Click to show internal directories.
Click to hide internal directories.