Documentation ¶
Index ¶
Constants ¶
const ( InputTypeString = "string" InputTypePassword = "password" InputTypeBool = "bool" InputTypeNumber = "number" )
accepted input types
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Input ¶
type Input struct { Name string `json:"name"` Description string `json:"description"` Regex *string `json:"regex,omitempty"` LegalValues []interface{} `json:"legal_values,omitempty"` Collection bool `json:"collection"` Type string `json:"type,omitempty"` Optional bool `json:"optional"` Default interface{} `json:"default"` }
Input represents a single input for a task it can express constraints on the acceptable values, such as a type (string by default), a regexp to be matched, an enumeration of legal values, wether a collection of values is accepted instead of a single value, and wether the input is altogether optional, which can be supported with a default value
func (Input) CheckValue ¶
CheckValue verifies an input's constraints against a concrete value
func (Input) Valid ¶
Valid asserts that an input definition is valid - a regexp and a legal_values list are mutually exclusive - a regexp must compile - the input's type must be among the accepted types defined above - legal_values must match the declared type - default value must match the declared type