Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultTag denotes the value to use if not set by other means. Must be // parseable to the same type as the value receiver DefaultTag = "default" // DelimiterTag denotes the separator used for slice types and enum options // (defaults to ",") DelimiterTag = "delim" // EnumTag denotes list of choices to constrain the value by. Every element // must be resolvable to the same type as the value reciver EnumTag = "enum" // EnvTag denotes the name of the environment variable EnvTag = "env" // FlagTag denotes the name of the cli flag FlagTag = "flag" // RequiredTag denotes whether or not the value must be set // (defaults to false) RequiredTag = "required" // UsageTag denotes help text for use with cli flags UsageTag = "usage" )
Functions ¶
Types ¶
type Field ¶
type Field struct { Name string Usage string FlagName *string EnvName *string Delimiter string Required bool Enum []string Value *Value }
Field contains the metadata extracted from struct field tags and the value setter
func NewField ¶
NewField extracts and parses the struct tags of a field and creates a value setter based on the struct field value receiver
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
Value is the built-in concrete ementation of Value
type ValueParser ¶
ValueParser receives a raw string and returns the resolved value or an error
Click to show internal directories.
Click to hide internal directories.