Documentation ¶
Overview ¶
Package validation provides the validation functions.
Index ¶
- func RegisterTranslation(tag, msg string) error
- func RegisterValidation(tag string, fn validator.Func) error
- func Validate(v string, tagOrRules []interface{}) error
- func ValidateStruct(s interface{}) error
- func ValidateValue(v interface{}, tag string) error
- type CustomRule
- type CustomRuleFunc
- type FieldLevel
- type StructError
- type Violation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterTranslation ¶
RegisterTranslation is shortcut of defaultValidator.RegisterTranslation that registers translations against the provided tag with given msg.
func RegisterValidation ¶
RegisterValidation is shortcut of defaultValidator.RegisterValidation that register custom validation with given tag, and it can be used in init.
func ValidateValue ¶
ValidateValue validates the value with the tag
Types ¶
type CustomRule ¶
type CustomRule struct { Tag string Func CustomRuleFunc Err error }
CustomRule is the custom rule struct.
type CustomRuleFunc ¶
type CustomRuleFunc = validator.Func
CustomRuleFunc custom rule check function.
type StructError ¶
type StructError struct {
Violations []Violation
}
StructError is the error returned by the validation of struct.
Click to show internal directories.
Click to hide internal directories.