Documentation
¶
Index ¶
- Variables
- type ABool
- func (a ABool) Check(v T, customErrMsg ...string) error
- func (a ABool) CheckAll(v T) []error
- func (m ABool) Custom(check func(v T) error) A
- func (m ABool) Eq(eq T, customErrMsg ...string) A
- func (a *ABool) False(customErrMsg ...string) *ABool
- func (m ABool) In(slice []T, customErrMsg ...string) A
- func (a ABool) Must(v T, customErrMsg ...string)
- func (a ABool) MustAll(v T)
- func (m ABool) NotEq(notEq T, customErrMsg ...string) A
- func (m ABool) NotIn(slice []T, customErrMsg ...string) A
- func (a *ABool) True(customErrMsg ...string) *ABool
- type AComparable
- func (a AComparable) Check(v T, customErrMsg ...string) error
- func (a AComparable) CheckAll(v T) []error
- func (m AComparable) Custom(check func(v T) error) A
- func (m AComparable) Eq(eq T, customErrMsg ...string) A
- func (m AComparable) In(slice []T, customErrMsg ...string) A
- func (a AComparable) Must(v T, customErrMsg ...string)
- func (a AComparable) MustAll(v T)
- func (m AComparable) NotEq(notEq T, customErrMsg ...string) A
- func (m AComparable) NotIn(slice []T, customErrMsg ...string) A
- type ANumeric
- func (a ANumeric) Check(v T, customErrMsg ...string) error
- func (a ANumeric) CheckAll(v T) []error
- func (m ANumeric) Custom(check func(v T) error) A
- func (m ANumeric) Eq(eq T, customErrMsg ...string) A
- func (m ANumeric) Greater(than T, customErrMsg ...string) A
- func (m ANumeric) GreaterAny(elems []T, customErrMsg ...string) A
- func (m ANumeric) GreaterEach(elems []T, customErrMsg ...string) A
- func (m ANumeric) GreaterEq(than T, customErrMsg ...string) A
- func (m ANumeric) GreaterEqAny(elems []T, customErrMsg ...string) A
- func (m ANumeric) GreaterEqEach(elems []T, customErrMsg ...string) A
- func (m ANumeric) In(slice []T, customErrMsg ...string) A
- func (m ANumeric) InRange(min T, max T, customErrMsg ...string) A
- func (m ANumeric) Less(than T, customErrMsg ...string) A
- func (m ANumeric) LessAny(elems []T, customErrMsg ...string) A
- func (m ANumeric) LessEach(elems []T, customErrMsg ...string) A
- func (m ANumeric) LessEq(than T, customErrMsg ...string) A
- func (m ANumeric) LessEqAny(elems []T, customErrMsg ...string) A
- func (m ANumeric) LessEqEach(elems []T, customErrMsg ...string) A
- func (a ANumeric) Must(v T, customErrMsg ...string)
- func (a ANumeric) MustAll(v T)
- func (a *ANumeric[T]) Negative(customErrMsg ...string) *ANumeric[T]
- func (m ANumeric) NotEq(notEq T, customErrMsg ...string) A
- func (m ANumeric) NotIn(slice []T, customErrMsg ...string) A
- func (m ANumeric) NotInRange(min T, max T, customErrMsg ...string) A
- func (a *ANumeric[T]) NotZero(customErrMsg ...string) *ANumeric[T]
- func (a *ANumeric[T]) Positive(customErrMsg ...string) *ANumeric[T]
- func (a *ANumeric[T]) Zero(customErrMsg ...string) *ANumeric[T]
- type AString
- func (a AString) Check(v T, customErrMsg ...string) error
- func (a AString) CheckAll(v T) []error
- func (m AString) Custom(check func(v T) error) A
- func (a *AString) Empty(customErrMsg ...string) *AString
- func (m AString) Eq(eq T, customErrMsg ...string) A
- func (m AString) In(slice []T, customErrMsg ...string) A
- func (a *AString) LenEq(eq int, customErrMsg ...string) *AString
- func (a *AString) LenInRange(min, max int, customErrMsg ...string) *AString
- func (a *AString) LenMax(max int, customErrMsg ...string) *AString
- func (a *AString) LenMin(min int, customErrMsg ...string) *AString
- func (a *AString) LenNotEq(notEq int, customErrMsg ...string) *AString
- func (a *AString) LenNotInRange(min, max int, customErrMsg ...string) *AString
- func (a AString) Must(v T, customErrMsg ...string)
- func (a AString) MustAll(v T)
- func (a *AString) NotEmpty(customErrMsg ...string) *AString
- func (m AString) NotEq(notEq T, customErrMsg ...string) A
- func (m AString) NotIn(slice []T, customErrMsg ...string) A
- func (a *AString) Numeric(customErrMsg ...string) *AString
- func (a *AString) Regexp(r *regexp.Regexp, customErrMsg ...string) *AString
- func (a *AString) Word(customErrMsg ...string) *AString
- type ATime
- func (a ATime) Check(v T, customErrMsg ...string) error
- func (a ATime) CheckAll(v T) []error
- func (m ATime) Custom(check func(v T) error) A
- func (m ATime) Eq(eq T, customErrMsg ...string) A
- func (m ATime) Greater(than T, customErrMsg ...string) A
- func (m ATime) GreaterAny(elems []T, customErrMsg ...string) A
- func (m ATime) GreaterEach(elems []T, customErrMsg ...string) A
- func (m ATime) GreaterEq(than T, customErrMsg ...string) A
- func (m ATime) GreaterEqAny(elems []T, customErrMsg ...string) A
- func (m ATime) GreaterEqEach(elems []T, customErrMsg ...string) A
- func (m ATime) In(slice []T, customErrMsg ...string) A
- func (m ATime) InRange(min T, max T, customErrMsg ...string) A
- func (m ATime) Less(than T, customErrMsg ...string) A
- func (m ATime) LessAny(elems []T, customErrMsg ...string) A
- func (m ATime) LessEach(elems []T, customErrMsg ...string) A
- func (m ATime) LessEq(than T, customErrMsg ...string) A
- func (m ATime) LessEqAny(elems []T, customErrMsg ...string) A
- func (m ATime) LessEqEach(elems []T, customErrMsg ...string) A
- func (a ATime) Must(v T, customErrMsg ...string)
- func (a ATime) MustAll(v T)
- func (m ATime) NotEq(notEq T, customErrMsg ...string) A
- func (m ATime) NotIn(slice []T, customErrMsg ...string) A
- func (m ATime) NotInRange(min T, max T, customErrMsg ...string) A
- func (a *ATime) NotZero(customErrMsg ...string) *ATime
- func (a *ATime) Zero(customErrMsg ...string) *ATime
- type ATimeDuration
- func (a ATimeDuration) Check(v T, customErrMsg ...string) error
- func (a ATimeDuration) CheckAll(v T) []error
- func (m ATimeDuration) Custom(check func(v T) error) A
- func (m ATimeDuration) Eq(eq T, customErrMsg ...string) A
- func (m ATimeDuration) Greater(than T, customErrMsg ...string) A
- func (m ATimeDuration) GreaterAny(elems []T, customErrMsg ...string) A
- func (m ATimeDuration) GreaterEach(elems []T, customErrMsg ...string) A
- func (m ATimeDuration) GreaterEq(than T, customErrMsg ...string) A
- func (m ATimeDuration) GreaterEqAny(elems []T, customErrMsg ...string) A
- func (m ATimeDuration) GreaterEqEach(elems []T, customErrMsg ...string) A
- func (m ATimeDuration) In(slice []T, customErrMsg ...string) A
- func (m ATimeDuration) InRange(min T, max T, customErrMsg ...string) A
- func (m ATimeDuration) Less(than T, customErrMsg ...string) A
- func (m ATimeDuration) LessAny(elems []T, customErrMsg ...string) A
- func (m ATimeDuration) LessEach(elems []T, customErrMsg ...string) A
- func (m ATimeDuration) LessEq(than T, customErrMsg ...string) A
- func (m ATimeDuration) LessEqAny(elems []T, customErrMsg ...string) A
- func (m ATimeDuration) LessEqEach(elems []T, customErrMsg ...string) A
- func (a ATimeDuration) Must(v T, customErrMsg ...string)
- func (a ATimeDuration) MustAll(v T)
- func (m ATimeDuration) NotEq(notEq T, customErrMsg ...string) A
- func (m ATimeDuration) NotIn(slice []T, customErrMsg ...string) A
- func (m ATimeDuration) NotInRange(min T, max T, customErrMsg ...string) A
- func (a *ATimeDuration) NotZero(customErrMsg ...string) *ATimeDuration
- func (a *ATimeDuration) Zero(customErrMsg ...string) *ATimeDuration
- type NumericTypes
Constants ¶
This section is empty.
Variables ¶
var StringRegexpNumeric = regexp.MustCompile("^-?\\d+(\\.\\d+)?$")
StringRegexpNumeric
Public variable to allow re-define globally.
var StringRegexpWord = regexp.MustCompile("^[A-Za-z](-?[A-Za-z]+)*$")
StringRegexpWord
Public variable to allow re-define globally.
Functions ¶
This section is empty.
Types ¶
type ABool ¶
type ABool struct {
// contains filtered or unexported fields
}
func (ABool) Check ¶
Check
Runs registered validation checks one by one against the given value and returns an error from a first failed check. Returns nil, if all checks pass.
func (ABool) CheckAll ¶
func (a ABool) CheckAll(v T) []error
CheckAll
Runs registered validation checks one by one against the given value and returns errors from all failed checks. Returns empty slice, if all checks pass.
func (ABool) Must ¶
func (a ABool) Must(v T, customErrMsg ...string)
Must
Calls Check and panics with the error if validation fails.
type AComparable ¶
type AComparable[T comparable] struct { // contains filtered or unexported fields }
func Comparable ¶
func Comparable[T comparable]() *AComparable[T]
func (AComparable) Check ¶
Check
Runs registered validation checks one by one against the given value and returns an error from a first failed check. Returns nil, if all checks pass.
func (AComparable) CheckAll ¶
func (a AComparable) CheckAll(v T) []error
CheckAll
Runs registered validation checks one by one against the given value and returns errors from all failed checks. Returns empty slice, if all checks pass.
func (AComparable) Must ¶
func (a AComparable) Must(v T, customErrMsg ...string)
Must
Calls Check and panics with the error if validation fails.
type ANumeric ¶
type ANumeric[T NumericTypes] struct { // contains filtered or unexported fields }
func Numeric ¶
func Numeric[T NumericTypes]() *ANumeric[T]
func (ANumeric) Check ¶
Check
Runs registered validation checks one by one against the given value and returns an error from a first failed check. Returns nil, if all checks pass.
func (ANumeric) CheckAll ¶
func (a ANumeric) CheckAll(v T) []error
CheckAll
Runs registered validation checks one by one against the given value and returns errors from all failed checks. Returns empty slice, if all checks pass.
func (ANumeric) GreaterAny ¶
func (m ANumeric) GreaterAny(elems []T, customErrMsg ...string) A
func (ANumeric) GreaterEach ¶
func (m ANumeric) GreaterEach(elems []T, customErrMsg ...string) A
func (ANumeric) GreaterEqAny ¶
func (m ANumeric) GreaterEqAny(elems []T, customErrMsg ...string) A
func (ANumeric) GreaterEqEach ¶
func (m ANumeric) GreaterEqEach(elems []T, customErrMsg ...string) A
func (ANumeric) LessEqEach ¶
func (m ANumeric) LessEqEach(elems []T, customErrMsg ...string) A
func (ANumeric) Must ¶
func (a ANumeric) Must(v T, customErrMsg ...string)
Must
Calls Check and panics with the error if validation fails.
func (ANumeric) MustAll ¶
func (a ANumeric) MustAll(v T)
MustAll
Calls CheckAll and panics with the error slice if validation fails.
func (ANumeric) NotInRange ¶
func (m ANumeric) NotInRange(min T, max T, customErrMsg ...string) A
type AString ¶
type AString struct {
// contains filtered or unexported fields
}
func (AString) Check ¶
Check
Runs registered validation checks one by one against the given value and returns an error from a first failed check. Returns nil, if all checks pass.
func (AString) CheckAll ¶
func (a AString) CheckAll(v T) []error
CheckAll
Runs registered validation checks one by one against the given value and returns errors from all failed checks. Returns empty slice, if all checks pass.
func (*AString) LenInRange ¶
func (*AString) LenNotInRange ¶
func (AString) Must ¶
func (a AString) Must(v T, customErrMsg ...string)
Must
Calls Check and panics with the error if validation fails.
func (AString) MustAll ¶
func (a AString) MustAll(v T)
MustAll
Calls CheckAll and panics with the error slice if validation fails.
type ATime ¶
type ATime struct {
// contains filtered or unexported fields
}
func (ATime) Check ¶
Check
Runs registered validation checks one by one against the given value and returns an error from a first failed check. Returns nil, if all checks pass.
func (ATime) CheckAll ¶
func (a ATime) CheckAll(v T) []error
CheckAll
Runs registered validation checks one by one against the given value and returns errors from all failed checks. Returns empty slice, if all checks pass.
func (ATime) GreaterAny ¶
func (m ATime) GreaterAny(elems []T, customErrMsg ...string) A
func (ATime) GreaterEach ¶
func (m ATime) GreaterEach(elems []T, customErrMsg ...string) A
func (ATime) GreaterEqAny ¶
func (m ATime) GreaterEqAny(elems []T, customErrMsg ...string) A
func (ATime) GreaterEqEach ¶
func (m ATime) GreaterEqEach(elems []T, customErrMsg ...string) A
func (ATime) LessEqEach ¶
func (m ATime) LessEqEach(elems []T, customErrMsg ...string) A
func (ATime) Must ¶
func (a ATime) Must(v T, customErrMsg ...string)
Must
Calls Check and panics with the error if validation fails.
func (ATime) MustAll ¶
func (a ATime) MustAll(v T)
MustAll
Calls CheckAll and panics with the error slice if validation fails.
func (ATime) NotInRange ¶
func (m ATime) NotInRange(min T, max T, customErrMsg ...string) A
type ATimeDuration ¶
type ATimeDuration struct {
// contains filtered or unexported fields
}
func TimeDuration ¶
func TimeDuration() *ATimeDuration
func (ATimeDuration) Check ¶
Check
Runs registered validation checks one by one against the given value and returns an error from a first failed check. Returns nil, if all checks pass.
func (ATimeDuration) CheckAll ¶
func (a ATimeDuration) CheckAll(v T) []error
CheckAll
Runs registered validation checks one by one against the given value and returns errors from all failed checks. Returns empty slice, if all checks pass.
func (ATimeDuration) GreaterAny ¶
func (m ATimeDuration) GreaterAny(elems []T, customErrMsg ...string) A
func (ATimeDuration) GreaterEach ¶
func (m ATimeDuration) GreaterEach(elems []T, customErrMsg ...string) A
func (ATimeDuration) GreaterEqAny ¶
func (m ATimeDuration) GreaterEqAny(elems []T, customErrMsg ...string) A
func (ATimeDuration) GreaterEqEach ¶
func (m ATimeDuration) GreaterEqEach(elems []T, customErrMsg ...string) A
func (ATimeDuration) InRange ¶
func (m ATimeDuration) InRange(min T, max T, customErrMsg ...string) A
func (ATimeDuration) LessEach ¶
func (m ATimeDuration) LessEach(elems []T, customErrMsg ...string) A
func (ATimeDuration) LessEqAny ¶
func (m ATimeDuration) LessEqAny(elems []T, customErrMsg ...string) A
func (ATimeDuration) LessEqEach ¶
func (m ATimeDuration) LessEqEach(elems []T, customErrMsg ...string) A
func (ATimeDuration) Must ¶
func (a ATimeDuration) Must(v T, customErrMsg ...string)
Must
Calls Check and panics with the error if validation fails.
func (ATimeDuration) MustAll ¶
func (a ATimeDuration) MustAll(v T)
MustAll
Calls CheckAll and panics with the error slice if validation fails.
func (ATimeDuration) NotInRange ¶
func (m ATimeDuration) NotInRange(min T, max T, customErrMsg ...string) A
func (*ATimeDuration) NotZero ¶
func (a *ATimeDuration) NotZero(customErrMsg ...string) *ATimeDuration
NotZero -- alias to NotEq(time.Duration(0))
func (*ATimeDuration) Zero ¶
func (a *ATimeDuration) Zero(customErrMsg ...string) *ATimeDuration
Zero -- alias to Eq(time.Duration(0))