Documentation ¶
Overview ¶
Package playground is a wrapper of the original "github.com/go-playground/validator" and "github.com/go-playground/mold" library.
All of the validation and modifier tags from both libraries can still be used here.
Index ¶
- Variables
- type Validator
- func (v *Validator) Modify(data interface{}) error
- func (v *Validator) RegisterModifier(name string, fn func(string) string) error
- func (v *Validator) RegisterValidator(name string, fn func(interface{}, ...string) bool) error
- func (v *Validator) RegisterValidatorError(name string, fn func(string, ...string) error) error
- func (v *Validator) Validate(data interface{}) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrRequiredName = errors.New("required name") ErrRequiredFn = errors.New("required function") ErrUnknownType = errors.New("unknown type") )
List of errors.
Functions ¶
This section is empty.
Types ¶
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator is validator and modifier client.
func New ¶
New to create new validator and modifier. Pass true if you want to modify the data automatically before validate.
func (*Validator) Modify ¶
Modify to modify/set struct field value according to modifier tag. Param `data` should be a pointer.
func (*Validator) RegisterModifier ¶
RegisterModifier to register custom modifier.
func (*Validator) RegisterValidator ¶
RegisterValidator to register custom validator.
func (*Validator) RegisterValidatorError ¶
RegisterValidatorError to register custom error message handling.
Click to show internal directories.
Click to hide internal directories.