mirror of
https://github.com/Fishwaldo/validator.git
synced 2025-07-09 22:51:03 +00:00
function rename
This commit is contained in:
parent
05d2507495
commit
cff7604ce7
2 changed files with 3 additions and 3 deletions
|
@ -8,14 +8,14 @@ import (
|
|||
)
|
||||
|
||||
var bakedInValidators = map[string]ValidationFunc{
|
||||
"required": isRequired,
|
||||
"required": required,
|
||||
"length": length,
|
||||
"min": min,
|
||||
"max": max,
|
||||
"regex": regex,
|
||||
}
|
||||
|
||||
func isRequired(field interface{}, param string) bool {
|
||||
func required(field interface{}, param string) bool {
|
||||
|
||||
return field != nil && field != reflect.Zero(reflect.TypeOf(field)).Interface()
|
||||
}
|
||||
|
|
|
@ -210,7 +210,7 @@ func (v *Validator) validateFieldByNameAndTag(f interface{}, name string, tag st
|
|||
return nil
|
||||
}
|
||||
|
||||
if strings.Contains(tag, omitempty) && !isRequired(f, "") {
|
||||
if strings.Contains(tag, omitempty) && !required(f, "") {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue