Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUnexpectedValidationError = errors.New("unexpected validation error"). WithCode("ERR_UNEXPECTED_VALIDATION_ERROR"). WithKind(errors.KindInternal) )
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Validator)
func WithJSONFieldNames ¶ added in v1.9.0
func WithJSONFieldNames() Option
type StructLevel ¶ added in v1.9.0
type StructLevel = validator.StructLevel
type StructLevelFunc ¶ added in v1.9.0
type StructLevelFunc = validator.StructLevelFunc
type Tag ¶ added in v1.9.0
type Tag interface {
Alias() string
Validate() func(fl validator.FieldLevel) bool
Translate() string
}
type TagEmail ¶ added in v1.9.0
type TagEmail struct {
UnimplementedTag
}
type TagPhone ¶ added in v1.9.0
type TagPhone struct {
UnimplementedTag
}
type TagRequired ¶ added in v1.9.0
type TagRequired struct {
UnimplementedTag
}
func (TagRequired) Translate ¶ added in v1.9.0
func (t TagRequired) Translate() string
type UnimplementedTag ¶ added in v1.9.0
type UnimplementedTag struct{}
func (UnimplementedTag) Alias ¶ added in v1.9.0
func (t UnimplementedTag) Alias() string
func (UnimplementedTag) Translate ¶ added in v1.9.0
func (t UnimplementedTag) Translate() string
func (UnimplementedTag) Validate ¶ added in v1.9.0
func (t UnimplementedTag) Validate() func(fl validator.FieldLevel) bool
type Validator ¶
func (*Validator) Struct ¶ added in v1.9.0
Struct validates a structs exposed fields, and automatically validates nested structs, unless otherwise specified.
It returns InvalidValidationError for bad values passed in and nil or ValidationErrors as error otherwise. You will need to assert the error if it's not nil eg. err.(validator.ValidationErrors) to access the array of errors.
Click to show internal directories.
Click to hide internal directories.