Documentation
¶
Overview ¶
Package validate supplies a struct validator to validate whether the field value of the struct is valid or not.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Validate = validator.New()
Validate is the default global validator.
var ValidateErrorFormatters = make(map[string]func(validator.FieldError) error)
ValidateErrorFormatters is the set of formatters to format validator.FieldError.
Functions ¶
func RegisterValidateErrorFormatter ¶
RegisterValidateErrorFormatter registers the field error formatter with the name, which will override it if the name has been registered.
If name is empty, it will panic. If f is nil, it will delete it.
func SetValidateTagName ¶
func SetValidateTagName(validator *validator.Validate, tags ...string)
SetValidateTagName registers a tag name function with the given tags into v.
func StructValidator ¶
func StructValidator(validate *validator.Validate) func(interface{}) error
StructValidator returns a new struct validator function, which is used to set the validator of the github.com/xgfone/ship#Ship.Validator.
If validate is nil, it is the global Validate by default.
Types ¶
This section is empty.