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.
19 lines
404 B
19 lines
404 B
10 years ago
|
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
|
||
|
}
|