Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Default ¶
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 Validate ¶
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.
Types ¶
type Defaulter ¶
type Defaulter interface {
Default(root interface{}, field *reflect.StructField)
}
type FieldValidator ¶
type FieldWalker ¶
type FieldWalker struct {
// contains filtered or unexported fields
}
func NewFieldWalker ¶
func NewFieldWalker(obj interface{}, callback fieldCallback) *FieldWalker
func (*FieldWalker) Walk ¶
func (w *FieldWalker) Walk()
Click to show internal directories.
Click to hide internal directories.