Documentation ¶
Overview ¶
Package validationjuice provides utility functions for validating struct fields based on their tags.
Index ¶
- func CheckNilValues(params ...interface{}) error
- func NewE164PhoneValidator() funccup.Validator
- func NewNonNilPointerFieldElemIsUTCDateValidator() funccup.Validator
- func NewNonNilPointerValidator() funccup.Validator
- func NewNonZeroPointerElemValidator() funccup.Validator
- func NewNonZeroValidator() funccup.Validator
- type ValidatorRegistryInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckNilValues ¶ added in v1.9.2
func CheckNilValues(params ...interface{}) error
CheckNilValues checks if any of the passed parameters are nil.
NOTE: Only parameters that have the possibility of being nil should be passed to this function. Passing a non-nil value of a type that cannot be nil (e.g., a string) will cause a panic.
func NewE164PhoneValidator ¶ added in v1.7.0
NewE164Validator returns a validator that checks if a field is a string and is a valid E.164 phone number.
func NewNonNilPointerFieldElemIsUTCDateValidator ¶ added in v1.8.2
NewNonNilPointerFieldElemIsUTCDateValidator returns a validator that checks if a field is a pointer, is not nil, and its underlying value is a valid UTC date.
func NewNonNilPointerValidator ¶ added in v1.4.1
NewNonNilPointerValidator returns a validator that checks if a field is a pointer and is not nil.
func NewNonZeroPointerElemValidator ¶ added in v1.4.1
NewNonNilPointerElemValidator returns a validator that checks if a field is a pointer, is not nil, and its underlying value is not zero.
func NewNonZeroValidator ¶
NewNonZeroValidator returns a validator that checks if a field is not a pointer and is not zero.
Types ¶
type ValidatorRegistryInterface ¶
type ValidatorRegistryInterface interface { AddValidator(string, funccup.Validator) RunTags(interface{}, string) error }
ValidatorRegistryInterface is an interface that defines the methods that a validatorRegistry must implement.
func NewValidatorRegistry ¶
func NewValidatorRegistry() ValidatorRegistryInterface
NewValidatorRegistry creates a new validatorRegistry and initializes its validators map.
It returns a ValidatorRegistryInterface.