genericwebhook

package
v0.0.0-...-e541717 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Aggregate

func Aggregate(errors field.ErrorList) error

func Default

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

func Register(name string, obj reflect.Type)

func Validate

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.

Types

type Defaulter

type Defaulter interface {
	Default(root interface{}, field *reflect.StructField)
}

type FieldValidator

type FieldValidator interface {
	Validate(root interface{}, path *field.Path) field.ErrorList
}

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()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL