Documentation ¶
Overview ¶
Package validate provides an easy way to validate the data contained in structs, typically being DTOs containing user input.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Check ¶
func Check[T any](v *Validator, value T, validatorFunc ValidatorFunc[T], key string)
Check checks if value passes the validatorFunc. The provided key is used for creating the errors map of the Validator.
func IsNotEmpty ¶
IsNotEmpty checks that the provided value is not empty.
func IsValidTimeZone ¶
IsValidTimeZone checks if the provided value is a valid IANA timezone.
Types ¶
type ValidatedType ¶ added in v0.1.1
type ValidatedType interface {
Validate() *Validator
}
ValidatedType is implemented by any struct with a Validate method.
type ValidatorFunc ¶
ValidatorFunc is the expected format used for validating data using Check.
func IsGreaterThanFunc ¶
func IsGreaterThanFunc[T shared.IntType](value1 T) ValidatorFunc[T]
IsGreaterThanFunc checks if the provided value2 > value1.
func IsGreaterThanOrEqualFunc ¶
func IsGreaterThanOrEqualFunc[T shared.IntType](value1 T) ValidatorFunc[T]
IsGreaterThanOrEqualFunc checks if the provided value2 >= value1.
func IsLesserThanFunc ¶
func IsLesserThanFunc[T shared.IntType](value1 T) ValidatorFunc[T]
IsLesserThanFunc checks if the provided value2 < value1.
func IsLesserThanOrEqualFunc ¶
func IsLesserThanOrEqualFunc[T shared.IntType](value1 T) ValidatorFunc[T]
IsLesserThanOrEqualFunc checks if the provided value2 <= value1.