Custom validation rules
You can add custom validation rules for string, int64, and float64.
v := govalid.New()
v.AddCustomInt64Rule("even", func(field string, value int64) string {
if value%2 == 0 {
return ""
}
return fmt.Sprintf("%s must be even", field)
})
type Foo struct {
Bar int64 `govalid:"req|even"`
}