Documentation
¶
Overview ¶
Package validator 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 ¶
func RegisterValidateErrorFormatter(name string, f func(validator.FieldError) error)
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 ¶
SetValidateTagName registers a tag name function with the given tags into v.
func StructValidator ¶
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.