Documentation ¶
Index ¶
- func ResemblesProviderFunction(dt reflect.Type) bool
- func SiftValidators(validators []any, root *reflect.Value, bindKind BindKind) ([]any, []any, error)
- func ValidateDoubleValidator(idx int, vt reflect.Type, bt reflect.Type) error
- func ValidateSoloValidator(idx int, vt reflect.Type) error
- func ValidateValidator(idx int, validator any, bt reflect.Type, includePostParse bool) (uint8, error)
- type BindKind
- type DefaultKind
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SiftValidators ¶
func SiftValidators( validators []any, root *reflect.Value, bindKind BindKind, ) ([]any, []any, error)
SiftValidators iterates through all the given validators, sifting them into two categories: pre-parse validators and post-parse validators.
Validators are all confirmed to be function types that expect and return the correct number and types of values. If any of the given values does not match one of the expected validator function forms, an error will be returned.
The valid function forms that are allowed are:
func(string) error // and func(T, string) error
In the above example, the type T must match the given binding type passed as the second argument to this function.
func ValidateDoubleValidator ¶
ValidateDoubleValidator tests the given function to ensure the double parameter function accepts the expected types.
func ValidateSoloValidator ¶
ValidateSoloValidator tests the given function to ensure the singular parameter function accepts the expected type.
func ValidateValidator ¶
func ValidateValidator( idx int, validator any, bt reflect.Type, includePostParse bool, ) (uint8, error)
ValidateValidator tests the given value (validator) to ensure that it is of a valid validator function type.
See SiftValidators for more details about what constitutes a valid validator function.
Types ¶
type DefaultKind ¶
type DefaultKind uint8
const ( DefaultKindNone DefaultKind = iota DefaultKindRaw DefaultKindParsed DefaultKindProviderPlain DefaultKindProviderWithErr DefaultKindUnknown = 254 DefaultKindInvalid = 255 )
func DetermineDefaultKind ¶
func DetermineDefaultKind(bind, def any) (kind DefaultKind, err error)