Documentation
¶
Index ¶
- Variables
- func Between[T Number](lowerBound, upperBound T) func(T) error
- func LengthBetween(lowerBound, upperBound int) func(string) error
- func LengthMax(upperBound int) func(string) error
- func LengthMin(lowerBound int) func(string) error
- func Max[T Number](upperBound T) func(T) error
- func Min[T Number](lowerBound T) func(T) error
- func MultipleOf[T Integer](divisor T) func(T) error
- func Negative[T Number](value T) error
- func NonNegative[T Number](value T) error
- func NotEmpty(value string) error
- func Positive[T Number](value T) error
- type Integer
- type Number
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrPositive = errors.New("validate: value must be positive") ErrBetween = errors.New("validate: value must be between") ErrNegative = errors.New("validate: value must be negative") ErrNonNegative = errors.New("validate: value must be non-negative") ErrMax = errors.New("validate: value must be less or equal than") ErrMin = errors.New("validate: value must be greater or equal than") ErrDivisorZero = errors.New("validate: divisor cannot be zero") ErrMultipleOf = errors.New("validate: value must be multiple of") )
View Source
var ( ErrNotEmpty = errors.New("validate: value cannot be empty") ErrLengthBetween = errors.New("validate: value's length must be between") ErrLengthMax = errors.New("validate: value's length must be less or equal than") ErrLengthMin = errors.New("validate: value's length must be greater or equal than") )
Functions ¶
func Between ¶
Between validates if a value is within the specified lower and upper bounds (inclusive).
func LengthBetween ¶ added in v1.2.5
LengthBetween validates if a string's length is between the specified bounds (inclusive).
func LengthMax ¶ added in v1.2.5
LengthMax ensures a string's length does not exceed the specified upperBound.
func LengthMin ¶ added in v1.2.5
LengthMin ensures a string's length is at least the specified lowerBound.
func MultipleOf ¶
MultipleOf validates if a value is a multiple of the specified divisor.
func NonNegative ¶
NonNegative validates that the provided numeric value is non-negative (including zero).
Types ¶
Click to show internal directories.
Click to hide internal directories.