Documentation ¶
Index ¶
- func HandleValidationError(log *zap.Logger, err error) []string
- type Validator
- func (v *Validator) AddCustomValidator(name string, f validatorFn) error
- func (v *Validator) AddStringModifier(name string, fn stringModifierFn) error
- func (v *Validator) AddStructLevelValidation(fn validator.StructLevelFunc, structType interface{})
- func (v *Validator) IsValidStruct(data interface{}) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator has functions for validating struct and variables
func (*Validator) AddCustomValidator ¶
AddCustomValidator adds a custom validator tag
Note :- This method is not thread-safe it is intended that these all be registered prior to any validation
func (*Validator) AddStringModifier ¶
AddStringModifier adds a tag that modifies the string value
Note :- This method is not thread-safe it is intended that these all be registered prior to any validation
func (*Validator) AddStructLevelValidation ¶
func (v *Validator) AddStructLevelValidation(fn validator.StructLevelFunc, structType interface{})
AddStructLevelValidation adds a custom struct level validation
Note :- This method is not thread-safe it is intended that these all be registered prior to any validation
func (*Validator) IsValidStruct ¶
IsValidStruct validates a struct and returns a list of invalid fields or nil
Click to show internal directories.
Click to hide internal directories.