func Aggregate(errs field.ErrorList) error
func Default(obj interface{}) field.ErrorList
Default would walk through all the fields of target struct recursively, and set the default value which declared with struct tag "default".
Parameter obj should be a pointer to a data struct.
Default should return an empty field.ErrorList.
func Register(name string, obj reflect.Type)
func Validate(obj interface{}) field.ErrorList
Validate would walk through all the fields of target struct recursively, and validate the value with validator declared with struct tag "webhook".
Parameter obj should be a pointer to a data struct.
Validate should return an empty field.ErrorList if all the fields are valid, or return each field.Error for every invalid values.
type Defaulter interface {
Default(root interface{}, field *reflect.StructField)
}
type FieldValidator interface {
Validate(root interface{}, path *field.Path) field.ErrorList
}
type FieldWalker struct {
// contains filtered or unexported fields
}
func NewFieldWalker(obj interface{}, callback fieldCallback) *FieldWalker
func (w *FieldWalker) Walk()