Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Duration ¶
A Duration validator should return an error if the time.Duration provided is not considered valid, nil otherwise.
func DurationMax ¶
DurationMax creates a Duration validator that fails when the time.Duration is strictly more than `max`.
func DurationMin ¶
DurationMin creates a Duration validator that fails when the time.Duration is strictly less than `min`.
func DurationRange ¶
DurationRange creates a Duration validator that fails when the time.Duration is strictly less than `min` or strictly more than `max`.
func DurationRounded ¶
DurationRounded creates a Duration validator that fails when the time.Duration is not a multiple of `r`
type Float64 ¶
A Float64 validator should return an error if the float64 provided is not considered valid, nil otherwise.
func Float64Max ¶
Float64Max creates a Float64 validator that fails when the float64 is strictly larger than `max`.
func Float64Min ¶
Float64Min creates a Float64 validator that fails when the float64 is strictly smaller than `min`.
func Float64Range ¶
Float64Range creates a Float64 validator that fails when the float64 is strictly smaller than `min` or strictly larger than `max`.
type Int ¶
A Int validator should return an error if the int provided is not considered valid, nil otherwise.
type Int64 ¶
A Int64 validator should return an error if the int64 provided is not considered valid, nil otherwise.
func Int64Max ¶
Int64Max creates a Int64 validator that fails when the int64 is strictly larger than `max`.
func Int64Min ¶
Int64Min creates a Int64 validator that fails when the int64 is strictly smaller than `min`.
func Int64Range ¶
Int64Range creates a Int64 validator that fails when the int64 is strictly smaller than `min` or strictly larger than `max`.
type Regexp ¶
A Regexp validator should return an error if the *regexp.Regexp provided is not considered valid, nil otherwise.
type Repeatable ¶
type Repeatable func(interface{}) error
A Repeatable validator should return an error if the value provided is not considered valid, nil otherwise. This validator is used on individual values of a rig.Repeatable
func ToRepeatable ¶
func ToRepeatable(validator interface{}) Repeatable
ToRepeatable turns some validator (i.e a func(int) error) into a validators.Repeatable (func(interface{}) error), removing the need to implement separate validators when dealing with repeatables.
type String ¶
A String validator should return an error if the string provided is not considered valid, nil otherwise.
func StringExcludeChars ¶
StringExcludeChars creates a String validator that fails when the string contains one ore more of the characters in `chars`.
func StringExcludePrefix ¶
StringExcludePrefix creates a String validator that fails when the string starts with `prefix`.
func StringExcludeSuffix ¶
StringExcludeSuffix creates a String validator that fails when the string ends with `suffix`.
func StringLengthMax ¶
StringLengthMax creates a String validator that fails when the string is strictly longer than `max`.
func StringLengthMin ¶
StringLengthMin creates a String validator that fails when the string is strictly shorter than `min`.
func StringLengthRange ¶
StringLengthRange creates a String validator that fails when the string is strictly shorter than `min` or strictly longer than `max`.
func StringNotEmpty ¶
func StringNotEmpty() String
StringNotEmpty creates a String validator that fails when the string is empty (after calling strings.TrimSpace).
type URL ¶
A URL validator should return an error if the *url.URL provided is not considered valid, nil otherwise.
func URLExcludeScheme ¶
URLExcludeScheme creates a URL validator that fails when the url.URL uses the scheme `scheme`. The validator never fails of `scheme` is empty.
type Uint ¶
A Uint validator should return an error if the uint provided is not considered valid, nil otherwise.
func UintMax ¶
UintMax creates a Uint validator that fails when the uint is strictly larger than `max`.
type Uint64 ¶
A Uint64 validator should return an error if the uint64 provided is not considered valid, nil otherwise.
func Uint64Max ¶
Uint64Max creates a Uint64 validator that fails when the uint64 is strictly larger than `max`.
func Uint64Min ¶
Uint64Min creates a Uint64 validator that fails when the uint64 is strictly smaller than `min`.
func Uint64Range ¶
Uint64Range creates a Uint64 validator that fails when the uint64 is strictly smaller than `min` or strictly larger than `max`.