💯Go Struct and Field validation, including Cross Field, Cross Struct, Map, Slice and Array diving
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
validator/baked_in.go

12 lines
256 B

package validator
import "reflect"
var bakedInValidators = map[string]ValidationFunc{
"required": isRequired,
}
func isRequired(field interface{}, param string) bool {
return field != nil && field != reflect.Zero(reflect.TypeOf(field)).Interface()
}