Documentation ¶
Index ¶
- func After(after time.Time) *afterRule
- func AfterOrEqual(afterOrEqual time.Time) *afterOrEqualRule
- func Array() *arrayRule
- func ArrayOf[Out any]() *arrayOfRule[Out]
- func Bail() *bailRule
- func Before(before time.Time) *beforeRule
- func BeforeOrEqual(beforeOrEqual time.Time) *beforeOrEqualRule
- func Between[T numberType](min, max T) *betweenRule[T]
- func BetweenExclusive[T numberType](min, max T) *betweenRule[T]
- func Boolean() *booleanRule
- func CompareNumbers[N1, N2 numberType](n1 N1, n2 N2) int
- func Custom[In any, Out any](validator customValidator[In, Out]) *customRule[In, Out]
- func Date() *dateFormatRule
- func DateFormat(format string) *dateFormatRule
- func Dereference(reference any) (value any, isNil bool)
- func DoesntEndWith(suffix string, suffixes ...string) *doesntEndWithRule
- func DoesntStartWith(prefix string, prefixes ...string) *doesntStartWithRule
- func Duration() *durationRule
- func Email() *emailRule
- func EmailAddress() *emailAddressRule
- func EndsWith(suffix string, suffixes ...string) *endsWithRule
- func Filled() *filledRule
- func Float[Out floatType]() *floatRule[Out]
- func IP() *ipRule
- func In[T comparable](values []T, options ...inRuleOption) *inRule[T]
- func InRuleWithComparator(comparator Comparator) inRuleOption
- func InRuleWithoutAutoDereference() inRuleOption
- func Integer[Out integerType]() *integerRule[Out]
- func Length[T integerType](length T) *lengthRule[T]
- func Map() *mapRule
- func Max[T numberType](max T) *maxRule[T]
- func MaxExclusive[T numberType](max T) *maxRule[T]
- func Min[T numberType](min T) *minRule[T]
- func MinExclusive[T numberType](min T) *minRule[T]
- func NotIn[T comparable](values []T, options ...notInRuleOption) *notInRule[T]
- func NotInRuleWithComparator(comparator Comparator) notInRuleOption
- func NotInRuleWithoutAutoDereference() notInRuleOption
- func NotRegex(regex *regexp.Regexp) *notRegexRule
- func Numeric() *numericRule
- func Regex(regex *regexp.Regexp) *regexRule
- func Required() *requiredRule
- func Slice() *sliceRule
- func SliceOf[Out any]() *sliceOfRule[Out]
- func StartsWith(prefix string, prefixes ...string) *startsWithRule
- func String() *stringRule
- func Struct() *structRule
- func URL() *urlRule
- func UUID(options ...uuidRuleOption) *uuidRule
- func UUIDRuleDisallowNilUUID() uuidRuleOption
- func UUIDRuleVersion1() uuidRuleOption
- func UUIDRuleVersion3() uuidRuleOption
- func UUIDRuleVersion4() uuidRuleOption
- func UUIDRuleVersion5() uuidRuleOption
- func When(condition bool, rules ...Rule) *whenFuncRule
- func WhenFunc(condition whenFuncCondition, rules ...Rule) *whenFuncRule
- type AfterOrEqualValidationError
- type AfterValidationError
- type ArrayOfValidationError
- type ArrayValidationError
- type Bailer
- type BailingRule
- type BeforeOrEqualValidationError
- type BeforeValidationError
- type BetweenValidationError
- type BooleanValidationError
- type Comparator
- type CustomValidationError
- type DateFormatValidationError
- type DoesntEndWithValidationError
- type DoesntStartWithValidationError
- type DurationValidationError
- type EmailValidationError
- type EndsWithValidationError
- type FilledValidationError
- type FloatValidationError
- type InValidationError
- type IntegerValidationError
- type IpValidationError
- type LengthValidationError
- type MapValidationError
- type MaxValidationError
- type MinValidationError
- type NotInValidationError
- type NotRegexValidationError
- type NumericValidationError
- type RegexValidationError
- type RequiredValidationError
- type Rule
- type SliceOfValidationError
- type SliceValidationError
- type StartsWithValidationError
- type StringValidationError
- type StructValidationError
- type UrlValidationError
- type UuidValidationError
- type WithSubRulesRule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AfterOrEqual ¶
func BeforeOrEqual ¶
func BetweenExclusive ¶ added in v0.2.0
func BetweenExclusive[T numberType](min, max T) *betweenRule[T]
func CompareNumbers ¶
func CompareNumbers[N1, N2 numberType](n1 N1, n2 N2) int
func DateFormat ¶
func DateFormat(format string) *dateFormatRule
func Dereference ¶
func DoesntEndWith ¶ added in v0.3.0
func DoesntStartWith ¶ added in v0.3.0
func EmailAddress ¶
func EmailAddress() *emailAddressRule
func In ¶
func In[T comparable](values []T, options ...inRuleOption) *inRule[T]
func InRuleWithComparator ¶ added in v0.2.0
func InRuleWithComparator(comparator Comparator) inRuleOption
func InRuleWithoutAutoDereference ¶ added in v0.2.0
func InRuleWithoutAutoDereference() inRuleOption
func MaxExclusive ¶ added in v0.3.0
func MaxExclusive[T numberType](max T) *maxRule[T]
func MinExclusive ¶ added in v0.3.0
func MinExclusive[T numberType](min T) *minRule[T]
func NotIn ¶ added in v0.3.0
func NotIn[T comparable](values []T, options ...notInRuleOption) *notInRule[T]
func NotInRuleWithComparator ¶ added in v0.3.0
func NotInRuleWithComparator(comparator Comparator) notInRuleOption
func NotInRuleWithoutAutoDereference ¶ added in v0.3.0
func NotInRuleWithoutAutoDereference() notInRuleOption
func StartsWith ¶ added in v0.3.0
func UUIDRuleDisallowNilUUID ¶ added in v0.3.0
func UUIDRuleDisallowNilUUID() uuidRuleOption
func UUIDRuleVersion1 ¶ added in v0.3.0
func UUIDRuleVersion1() uuidRuleOption
func UUIDRuleVersion3 ¶ added in v0.3.0
func UUIDRuleVersion3() uuidRuleOption
func UUIDRuleVersion4 ¶ added in v0.3.0
func UUIDRuleVersion4() uuidRuleOption
func UUIDRuleVersion5 ¶ added in v0.3.0
func UUIDRuleVersion5() uuidRuleOption
Types ¶
type AfterOrEqualValidationError ¶
type AfterOrEqualValidationError struct { ve.BasicValidationError AfterOrEqual string `json:"after_or_equal"` }
func NewAfterOrEqualValidationError ¶
func NewAfterOrEqualValidationError(afterOrEqual string) AfterOrEqualValidationError
func (AfterOrEqualValidationError) Error ¶
func (e AfterOrEqualValidationError) Error() string
type AfterValidationError ¶
type AfterValidationError struct { ve.BasicValidationError After string `json:"after"` }
func NewAfterValidationError ¶
func NewAfterValidationError(after string) AfterValidationError
func (AfterValidationError) Error ¶
func (e AfterValidationError) Error() string
type ArrayOfValidationError ¶ added in v0.2.0
type ArrayOfValidationError struct { ve.BasicValidationError ExpectedType string `json:"expected_type"` ActualType string `json:"actual_type"` }
func NewArrayOfValidationError ¶ added in v0.2.0
func NewArrayOfValidationError(expected, actual string) ArrayOfValidationError
func (ArrayOfValidationError) Error ¶ added in v0.2.0
func (e ArrayOfValidationError) Error() string
type ArrayValidationError ¶ added in v0.2.0
type ArrayValidationError struct {
ve.BasicValidationError
}
func NewArrayValidationError ¶ added in v0.2.0
func NewArrayValidationError() ArrayValidationError
func (ArrayValidationError) Error ¶ added in v0.2.0
func (ArrayValidationError) Error() string
type Bailer ¶
type Bailer struct {
// contains filtered or unexported fields
}
func (*Bailer) MarkBailed ¶ added in v0.2.0
func (b *Bailer) MarkBailed()
type BailingRule ¶
type BailingRule interface {
Bails() bool
}
type BeforeOrEqualValidationError ¶
type BeforeOrEqualValidationError struct { ve.BasicValidationError BeforeOrEqual string `json:"after_or_equal"` }
func NewBeforeOrEqualValidationError ¶
func NewBeforeOrEqualValidationError(beforeOrEqual string) BeforeOrEqualValidationError
func (BeforeOrEqualValidationError) Error ¶
func (e BeforeOrEqualValidationError) Error() string
type BeforeValidationError ¶
type BeforeValidationError struct { ve.BasicValidationError Before string `json:"before"` }
func NewBeforeValidationError ¶
func NewBeforeValidationError(before string) BeforeValidationError
func (BeforeValidationError) Error ¶
func (e BeforeValidationError) Error() string
type BetweenValidationError ¶ added in v0.2.0
type BetweenValidationError[T numberType] struct { ve.BasicValidationError Type string `json:"type"` Min T `json:"min"` Max T `json:"max"` Inclusive bool `json:"inclusive"` }
func NewBetweenValidationError ¶ added in v0.2.0
func NewBetweenValidationError[T numberType](st string, min, max T, inclusive bool) BetweenValidationError[T]
func (BetweenValidationError[T]) Error ¶ added in v0.2.0
func (e BetweenValidationError[T]) Error() string
type BooleanValidationError ¶
type BooleanValidationError struct {
ve.BasicValidationError
}
func NewBooleanValidationError ¶
func NewBooleanValidationError() BooleanValidationError
func (BooleanValidationError) Error ¶
func (e BooleanValidationError) Error() string
type Comparator ¶ added in v0.2.0
type CustomValidationError ¶
type CustomValidationError struct { ve.BasicValidationError Err string `json:"error"` }
func NewCustomValidationError ¶
func NewCustomValidationError(err error) CustomValidationError
func (CustomValidationError) Error ¶
func (e CustomValidationError) Error() string
type DateFormatValidationError ¶
type DateFormatValidationError struct { ve.BasicValidationError Format string `json:"format"` }
func NewDateFormatValidationError ¶
func NewDateFormatValidationError(format string) DateFormatValidationError
func (DateFormatValidationError) Error ¶
func (e DateFormatValidationError) Error() string
type DoesntEndWithValidationError ¶ added in v0.3.0
type DoesntEndWithValidationError struct { ve.BasicValidationError Suffixes []string `json:"suffixes"` }
func NewDoesntEndWithValidationError ¶ added in v0.3.0
func NewDoesntEndWithValidationError(suffixes []string) DoesntEndWithValidationError
func (DoesntEndWithValidationError) Error ¶ added in v0.3.0
func (e DoesntEndWithValidationError) Error() string
type DoesntStartWithValidationError ¶ added in v0.3.0
type DoesntStartWithValidationError struct { ve.BasicValidationError Prefixes []string `json:"prefixes"` }
func NewDoesntStartWithValidationError ¶ added in v0.3.0
func NewDoesntStartWithValidationError(prefixes []string) DoesntStartWithValidationError
func (DoesntStartWithValidationError) Error ¶ added in v0.3.0
func (e DoesntStartWithValidationError) Error() string
type DurationValidationError ¶
type DurationValidationError struct {
ve.BasicValidationError
}
func NewDurationValidationError ¶
func NewDurationValidationError() DurationValidationError
func (DurationValidationError) Error ¶
func (e DurationValidationError) Error() string
type EmailValidationError ¶
type EmailValidationError struct {
ve.BasicValidationError
}
func NewEmailValidationError ¶
func NewEmailValidationError() EmailValidationError
func (EmailValidationError) Error ¶
func (e EmailValidationError) Error() string
type EndsWithValidationError ¶ added in v0.3.0
type EndsWithValidationError struct { ve.BasicValidationError Suffixes []string `json:"suffixes"` }
func NewEndsWithValidationError ¶ added in v0.3.0
func NewEndsWithValidationError(suffixes []string) EndsWithValidationError
func (EndsWithValidationError) Error ¶ added in v0.3.0
func (e EndsWithValidationError) Error() string
type FilledValidationError ¶ added in v0.3.0
type FilledValidationError struct {
ve.BasicValidationError
}
func NewFilledValidationError ¶ added in v0.3.0
func NewFilledValidationError() FilledValidationError
func (FilledValidationError) Error ¶ added in v0.3.0
func (FilledValidationError) Error() string
type FloatValidationError ¶
type FloatValidationError struct { ve.BasicValidationError ExpectedType string `json:"expected_type"` ActualType string `json:"actual_type"` }
func NewFloatValidationError ¶
func NewFloatValidationError(expectedType, actualType string) FloatValidationError
func (FloatValidationError) Error ¶
func (e FloatValidationError) Error() string
type InValidationError ¶
type InValidationError[T any] struct { ve.BasicValidationError Values []T `json:"values"` }
func NewInValidationError ¶
func NewInValidationError[T any](values []T) InValidationError[T]
func (InValidationError[T]) Error ¶
func (e InValidationError[T]) Error() string
type IntegerValidationError ¶
type IntegerValidationError struct { ve.BasicValidationError ExpectedType string `json:"expected_type"` ActualType string `json:"actual_type"` }
func NewIntegerValidationError ¶
func NewIntegerValidationError(expectedType, actualType string) IntegerValidationError
func (IntegerValidationError) Error ¶
func (e IntegerValidationError) Error() string
type IpValidationError ¶ added in v0.3.0
type IpValidationError struct {
ve.BasicValidationError
}
func NewIpValidationError ¶ added in v0.3.0
func NewIpValidationError() IpValidationError
func (IpValidationError) Error ¶ added in v0.3.0
func (e IpValidationError) Error() string
type LengthValidationError ¶
type LengthValidationError[T integerType] struct { ve.BasicValidationError Type string `json:"type"` Length T `json:"length"` }
func NewLengthValidationError ¶
func NewLengthValidationError[T integerType](st string, threshold T) LengthValidationError[T]
func (LengthValidationError[T]) Error ¶
func (e LengthValidationError[T]) Error() string
type MapValidationError ¶ added in v0.2.0
type MapValidationError struct {
ve.BasicValidationError
}
func NewMapValidationError ¶ added in v0.2.0
func NewMapValidationError() MapValidationError
func (MapValidationError) Error ¶ added in v0.2.0
func (MapValidationError) Error() string
type MaxValidationError ¶
type MaxValidationError[T numberType] struct { ve.BasicValidationError Type string `json:"type"` Threshold T `json:"threshold"` Inclusive bool `json:"inclusive"` }
func NewMaxValidationError ¶
func NewMaxValidationError[T numberType](st string, threshold T, inclusive bool) MaxValidationError[T]
func (MaxValidationError[T]) Error ¶
func (e MaxValidationError[T]) Error() string
type MinValidationError ¶
type MinValidationError[T numberType] struct { ve.BasicValidationError Type string `json:"type"` Threshold T `json:"threshold"` Inclusive bool `json:"inclusive"` }
func NewMinValidationError ¶
func NewMinValidationError[T numberType](st string, threshold T, inclusive bool) MinValidationError[T]
func (MinValidationError[T]) Error ¶
func (e MinValidationError[T]) Error() string
type NotInValidationError ¶ added in v0.3.0
type NotInValidationError[T any] struct { ve.BasicValidationError Values []T `json:"values"` }
func NewNotInValidationError ¶ added in v0.3.0
func NewNotInValidationError[T any](values []T) NotInValidationError[T]
func (NotInValidationError[T]) Error ¶ added in v0.3.0
func (e NotInValidationError[T]) Error() string
type NotRegexValidationError ¶ added in v0.3.0
type NotRegexValidationError struct {
ve.BasicValidationError
}
func NewNotRegexValidationError ¶ added in v0.3.0
func NewNotRegexValidationError() NotRegexValidationError
func (NotRegexValidationError) Error ¶ added in v0.3.0
func (e NotRegexValidationError) Error() string
type NumericValidationError ¶ added in v0.3.0
type NumericValidationError struct {
ve.BasicValidationError
}
func NewNumericValidationError ¶ added in v0.3.0
func NewNumericValidationError() NumericValidationError
func (NumericValidationError) Error ¶ added in v0.3.0
func (e NumericValidationError) Error() string
type RegexValidationError ¶ added in v0.3.0
type RegexValidationError struct {
ve.BasicValidationError
}
func NewRegexValidationError ¶ added in v0.3.0
func NewRegexValidationError() RegexValidationError
func (RegexValidationError) Error ¶ added in v0.3.0
func (e RegexValidationError) Error() string
type RequiredValidationError ¶
type RequiredValidationError struct {
ve.BasicValidationError
}
func NewRequiredValidationError ¶
func NewRequiredValidationError() RequiredValidationError
func (RequiredValidationError) Error ¶
func (RequiredValidationError) Error() string
type SliceOfValidationError ¶
type SliceOfValidationError struct { ve.BasicValidationError ExpectedType string `json:"expected_type"` ActualType string `json:"actual_type"` }
func NewSliceOfValidationError ¶
func NewSliceOfValidationError(expected, actual string) SliceOfValidationError
func (SliceOfValidationError) Error ¶
func (e SliceOfValidationError) Error() string
type SliceValidationError ¶
type SliceValidationError struct {
ve.BasicValidationError
}
func NewSliceValidationError ¶
func NewSliceValidationError() SliceValidationError
func (SliceValidationError) Error ¶
func (SliceValidationError) Error() string
type StartsWithValidationError ¶ added in v0.3.0
type StartsWithValidationError struct { ve.BasicValidationError Prefixes []string `json:"prefixes"` }
func NewStartsWithValidationError ¶ added in v0.3.0
func NewStartsWithValidationError(prefixes []string) StartsWithValidationError
func (StartsWithValidationError) Error ¶ added in v0.3.0
func (e StartsWithValidationError) Error() string
type StringValidationError ¶
type StringValidationError struct {
ve.BasicValidationError
}
func NewStringValidationError ¶
func NewStringValidationError() StringValidationError
func (StringValidationError) Error ¶
func (StringValidationError) Error() string
type StructValidationError ¶ added in v0.2.0
type StructValidationError struct {
ve.BasicValidationError
}
func NewStructValidationError ¶ added in v0.2.0
func NewStructValidationError() StructValidationError
func (StructValidationError) Error ¶ added in v0.2.0
func (StructValidationError) Error() string
type UrlValidationError ¶ added in v0.3.0
type UrlValidationError struct {
ve.BasicValidationError
}
func NewUrlValidationError ¶ added in v0.3.0
func NewUrlValidationError() UrlValidationError
func (UrlValidationError) Error ¶ added in v0.3.0
func (e UrlValidationError) Error() string
type UuidValidationError ¶ added in v0.3.0
type UuidValidationError struct {
ve.BasicValidationError
}
func NewUuidValidationError ¶ added in v0.3.0
func NewUuidValidationError() UuidValidationError
func (UuidValidationError) Error ¶ added in v0.3.0
func (e UuidValidationError) Error() string
Source Files ¶
- after.go
- after_or_equal.go
- array.go
- array_of.go
- bail.go
- before.go
- before_or_equal.go
- between.go
- between_exclusive.go
- boolean.go
- custom.go
- date.go
- date_format.go
- doesnt_end_with.go
- doesnt_start_with.go
- duration.go
- email.go
- email_address.go
- ends_with.go
- filled.go
- float.go
- in.go
- integer.go
- ip.go
- length.go
- map.go
- max.go
- max_exclusive.go
- min.go
- min_exclusive.go
- not_in.go
- not_regex.go
- numeric.go
- regex.go
- required.go
- rules.go
- slice.go
- slice_of.go
- starts_with.go
- string.go
- struct.go
- url.go
- uuid.go
- when.go
- when_func.go
Click to show internal directories.
Click to hide internal directories.