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.
18 lines
404 B
18 lines
404 B
package validator
|
|
|
|
import (
|
|
"log"
|
|
"reflect"
|
|
)
|
|
|
|
var bakedInValidators = map[string]ValidationFunc{
|
|
"required": isRequired,
|
|
}
|
|
|
|
func isRequired(field interface{}, param string) bool {
|
|
|
|
log.Printf("Required:%s Valid:%t\n", field, field != nil && field != reflect.Zero(reflect.TypeOf(field)).Interface())
|
|
return field != nil && field != reflect.Zero(reflect.TypeOf(field)).Interface()
|
|
|
|
// return true
|
|
}
|
|
|