Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConstraintFunction ¶
type ConstraintFunction func() bool
validate constraints independent from the inputs
(As an example, we could imagine a cli subcommand that could only be run on Unix based systems. In this case, a constraint function allow the developper to restrict the use of a specific command and it's subcommands to Unix based systems)
type DefaultValueFunction ¶
type DefaultValueFunction func() (dynamicDefault interface{})
Function that return a default value, this value may be dynamic
type NormalizationFunction ¶
type NormalizationFunction func(input interface{}) (output interface{})
Returns a normalized version of the input.
For examples of implementation, please head to the normalizators package
type ValidationFunction ¶
type ValidationFunction func(input interface{}) (err error)
Returns an error of the input is not valid
For examples of implementation, please head to the validators package
type Validator ¶
type Validator struct { // The name of the validator // It's printed when the Validation Function returns an error Name string // The validation function, it returns an error when the input is not valid Func ValidationFunction }
A validator is used when it's needed to validate an input from verdeter, whether the input comes from the user of the app or a default value