Documentation
¶
Index ¶
- Variables
- func ErrEnum[T comparable](a ...T) error
- func ErrMaxLen(max int) error
- func ErrNilElement(i int) error
- func ErrNumberRange[T Number](min T, max T) error
- func ErrStringMatchRegex(regexp *regexp.Regexp) error
- func ErrStringRange(mix int, max int) error
- func Required[T comparable](v T) error
- func SliceNoneNil[T any](v []T) error
- func Validate(validators ...Validator) error
- type Number
- type Validator
- type ValidatorFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrRequired = errors.New("value is required")
Functions ¶
func ErrEnum ¶
func ErrEnum[T comparable](a ...T) error
func ErrNilElement ¶
func ErrNumberRange ¶
func ErrStringMatchRegex ¶
func ErrStringRange ¶
func Required ¶
func Required[T comparable](v T) error
func SliceNoneNil ¶
Types ¶
type Validator ¶
type Validator interface {
Validate() error
}
func New ¶
func New[T any](v T, validatorFuncs ...ValidatorFunc[T]) Validator
type ValidatorFunc ¶
func Enum ¶
func Enum[T comparable](a ...T) ValidatorFunc[T]
func NumberRange ¶
func NumberRange[T Number](min T, max T) ValidatorFunc[T]
func SliceMaxLen ¶
func SliceMaxLen[T any](max int) ValidatorFunc[[]T]
func StringMatchRegex ¶
func StringMatchRegex(regexp *regexp.Regexp) ValidatorFunc[string]
func StringRange ¶
func StringRange(min int, max int) ValidatorFunc[string]
Source Files
¶
Click to show internal directories.
Click to hide internal directories.
