Documentation
¶
Overview ¶
Package checker provides a way to run checks against a variadic number of inputs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ValidateFunc ¶
type ValidateFunc func() error
ValidateFunc is a function type that takes an input of any type and returns an error if the validation fails.
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator is a struct that holds a list of checks to be performed.
func NewValidator ¶
func NewValidator(c ...ValidatorCheck) Validator
NewValidator creates a new Validator with the given checks.
func (Validator) AddChecks ¶
func (v Validator) AddChecks(c ...ValidatorCheck) Validator
AddChecks adds additional checks to the Validator.
type ValidatorCheck ¶
type ValidatorCheck struct {
// contains filtered or unexported fields
}
ValidatorCheck is a struct that holds the name and function of a check to be performed. The function should return an error if the check fails. Use closures to capture the context of the check, such as the resource type or other parameters.
func NewValidatorCheck ¶
func NewValidatorCheck(name string, f ValidateFunc) ValidatorCheck
NewValidatorCheck creates a new ValidatorCheck with the given name and function.