models

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 20, 2023 License: MPL-2.0 Imports: 0 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigType

type ConfigType int

ConfigType type used in key definitions

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL