Documentation
¶
Overview ¶
Package validators contains the validation functions for the application. these specificially relate to the prompts/questions asked to the user and validating the user input.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NotZero ¶
func NotZero[T Validatable](v T) error
NotZero validates that the value is not zero. It returns an error if the value is zero.
Types ¶
type Validatable ¶ added in v0.3.0
type Validate ¶ added in v0.3.0
type Validate struct { Required bool `yaml:"required"` MinLength int `yaml:"min"` MaxLength int `yaml:"max"` Match ValidateMatch `yaml:"match"` }
Validate is a struct the holds the configuration for a validator.
type ValidateMatch ¶ added in v0.3.0
type Validator ¶
func GetValidatorFuncs ¶ added in v0.3.0
func GetValidatorFuncs[T Validatable](v Validate) []Validator[T]
GetValidatorFuncs converts a Validate struct into a slice of validator functions.
func MinLength ¶
func MinLength[T Validatable](m int) Validator[T]
MinLength validates that the value is at least m long.
Click to show internal directories.
Click to hide internal directories.