|
|
@ -8,14 +8,14 @@ import ( |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
var bakedInValidators = map[string]ValidationFunc{ |
|
|
|
var bakedInValidators = map[string]ValidationFunc{ |
|
|
|
"required": isRequired, |
|
|
|
"required": required, |
|
|
|
"length": length, |
|
|
|
"length": length, |
|
|
|
"min": min, |
|
|
|
"min": min, |
|
|
|
"max": max, |
|
|
|
"max": max, |
|
|
|
"regex": regex, |
|
|
|
"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() |
|
|
|
return field != nil && field != reflect.Zero(reflect.TypeOf(field)).Interface() |
|
|
|
} |
|
|
|
} |
|
|
|