v2.0.0
Validator struct
- Validate more clean for source code
validator := gody.NewValidator()
if validated, err := validator.Validate(/*struct*/); err != nil {
...
}
- On demand rules
...
if err := validator.AddRules(/*...rules*/); err != nil {
...
}
...
- Support for set a custom tag name
...
if err := validator.SetTagName(/*name*/); err != nil {
...
}
...
Raw functions support
- RawSerialize receive tag name and the struct to validate.
func RawSerialize(tn string, b interface{}) ([]Field, error)
- RawValidate receive the struct to validate, tag name and custom rules.
func RawValidate(b interface{}, tn string, rules []Rule) (bool, error)
- RawDefaultValidate receive the struct to validate, tag name and custom rules.
func RawDefaultValidate(b interface{}, tn string, rules []Rule) (bool, error)
📓
DefaultValidate
andRawDefaultValidate
it's same, both uses as default rules built-in gody.
Remove the necessity for tag in struct and slice validation
issue #9