Documentation ¶
Index ¶
- Constants
- func Bool(name string, value bool) *bool
- func BoolVar(p *bool, name string, value bool)
- func Duration(name string, value time.Duration) *time.Duration
- func DurationVar(p *time.Duration, name string, value time.Duration)
- func Float64(name string, value float64) *float64
- func Float64Var(p *float64, name string, value float64)
- func Int(name string, value int) *int
- func Int64(name string, value int64) *int64
- func Int64Var(p *int64, name string, value int64)
- func IntVar(p *int, name string, value int)
- func Parse(path string) error
- func ParseBytes(path string) error
- func SetPrefix(prefix string)
- func String(name string, value string) *string
- func StringVar(p *string, name string, value string)
- func Uint(name string, value uint) *uint
- func Uint64(name string, value uint64) *uint64
- func Uint64Var(p *uint64, name string, value uint64)
- func UintVar(p *uint, name string, value uint)
- func Var(value flag.Value, name string)
- type ConfigSet
- func (c *ConfigSet) Bool(name string, value bool) *bool
- func (c *ConfigSet) BoolVar(p *bool, name string, value bool)
- func (c *ConfigSet) Duration(name string, value time.Duration) *time.Duration
- func (c *ConfigSet) DurationVar(p *time.Duration, name string, value time.Duration)
- func (c *ConfigSet) Float64(name string, value float64) *float64
- func (c *ConfigSet) Float64Var(p *float64, name string, value float64)
- func (c *ConfigSet) Int(name string, value int) *int
- func (c *ConfigSet) Int64(name string, value int64) *int64
- func (c *ConfigSet) Int64Var(p *int64, name string, value int64)
- func (c *ConfigSet) IntVar(p *int, name string, value int)
- func (c *ConfigSet) Parse(path string) error
- func (c *ConfigSet) ParseBytes(data []byte) error
- func (c *ConfigSet) SetPrefix(prefix string)
- func (c *ConfigSet) String(name string, value string) *string
- func (c *ConfigSet) StringVar(p *string, name string, value string)
- func (c *ConfigSet) Strings(name string) *StringParams
- func (c *ConfigSet) Uint(name string, value uint) *uint
- func (c *ConfigSet) Uint64(name string, value uint64) *uint64
- func (c *ConfigSet) Uint64Var(p *uint64, name string, value uint64)
- func (c *ConfigSet) UintVar(p *uint, name string, value uint)
- func (c *ConfigSet) Var(value flag.Value, name string)
- type StringParams
Constants ¶
const ( ContinueOnError flag.ErrorHandling = flag.ContinueOnError ExitOnError flag.ErrorHandling = flag.ExitOnError PanicOnError flag.ErrorHandling = flag.PanicOnError )
Variables ¶
This section is empty.
Functions ¶
func BoolVar ¶
BoolVar defines a bool config with a given name and default value. The argument p points to a bool variable in which to store the value of the config.
func Duration ¶
Duration defines a time.Duration config variable with a given name and default value.
func DurationVar ¶
DurationVar defines a time.Duration config with a given name and default value. The argument p points to a time.Duration variable in which to store the value of the config.
func Float64Var ¶
Float64Var defines a float64 config with a given name and default value. The argument p points to a float64 variable in which to store the value of the config.
func Int64Var ¶
Int64Var defines a int64 config with a given name and default value. The argument p points to a int64 variable in which to store the value of the config.
func IntVar ¶
IntVar defines a int config with a given name and default value. The argument p points to a int variable in which to store the value of the config.
func Parse ¶
Parse takes a path to a TOML file and loads it into the global ConfigSet. This must be called after all config flags have been defined but before the flags are accessed by the program.
func ParseBytes ¶
ParseBytes takes a TOML file in byte array format and loads it into the global ConfigSet. This must be called after all config flags have been defined but before the flags are accessed by the program.
func SetPrefix ¶
func SetPrefix(prefix string)
SetPrefix sets the applicatin prefix to use when filtering environment variables. If prefix is empty, all environment variables are ignored.
func StringVar ¶
StringVar defines a string config with a given name and default value. The argument p points to a string variable in which to store the value of the config.
func Uint64Var ¶
Uint64Var defines a uint64 config with a given name and default value. The argument p points to a uint64 variable in which to store the value of the config.
Types ¶
type ConfigSet ¶
func NewConfigSet ¶
func NewConfigSet(name string, errorHandling flag.ErrorHandling) *ConfigSet
NewConfigSet returns a new ConfigSet with the given name and error handling policy. The three valid error handling policies are: flag.ContinueOnError, flag.ExitOnError, and flag.PanicOnError.
func (*ConfigSet) Bool ¶
Bool defines a bool config variable with a given name and default value for a ConfigSet.
func (*ConfigSet) BoolVar ¶
BoolVar defines a bool config with a given name and default value for a ConfigSet. The argument p points to a bool variable in which to store the value of the config.
func (*ConfigSet) Duration ¶
Duration defines a time.Duration config variable with a given name and default value.
func (*ConfigSet) DurationVar ¶
DurationVar defines a time.Duration config with a given name and default value for a ConfigSet. The argument p points to a time.Duration variable in which to store the value of the config.
func (*ConfigSet) Float64 ¶
Float64 defines a float64 config variable with a given name and default value for a ConfigSet.
func (*ConfigSet) Float64Var ¶
Float64Var defines a float64 config with a given name and default value for a ConfigSet. The argument p points to a float64 variable in which to store the value of the config.
func (*ConfigSet) Int ¶
Int defines a int config variable with a given name and default value for a ConfigSet.
func (*ConfigSet) Int64 ¶
Int64 defines a int64 config variable with a given name and default value for a ConfigSet.
func (*ConfigSet) Int64Var ¶
Int64Var defines a int64 config with a given name and default value for a ConfigSet. The argument p points to a int64 variable in which to store the value of the config.
func (*ConfigSet) IntVar ¶
IntVar defines a int config with a given name and default value for a ConfigSet. The argument p points to a int variable in which to store the value of the config.
func (*ConfigSet) Parse ¶
Parse takes a path to a TOML file and loads it. This must be called after all the config flags in the ConfigSet have been defined but before the flags are accessed by the program.
If the path is empty, no TOML file is loaded. Only environment variables matching the application Prefix will populate the config flags.
func (*ConfigSet) ParseBytes ¶
ParseBytes takes a TOML file in byte array format and loads it. This must be called after all the config flags in the ConfigSet have been defined but before the flags are accessed by the program.
func (*ConfigSet) SetPrefix ¶
SetPrefix sets the applicatin prefix to use when filtering environment variables. If prefix is empty, all environment variables are ignored.
func (*ConfigSet) String ¶
String defines a string config variable with a given name and default value for a ConfigSet.
func (*ConfigSet) StringVar ¶
StringVar defines a string config with a given name and default value for a ConfigSet. The argument p points to a string variable in which to store the value of the config.
func (*ConfigSet) Strings ¶
func (c *ConfigSet) Strings(name string) *StringParams
Strings defines a string slice config variable with a given name.
func (*ConfigSet) Uint ¶
Uint defines a uint config variable with a given name and default value for a ConfigSet.
func (*ConfigSet) Uint64 ¶
Uint64 defines a uint64 config variable with a given name and default value for a ConfigSet.
func (*ConfigSet) Uint64Var ¶
Uint64Var defines a uint64 config with a given name and default value for a ConfigSet. The argument p points to a uint64 variable in which to store the value of the config.
type StringParams ¶
type StringParams []string
func Strings ¶
func Strings(name string) *StringParams
Strings defines a string slice config variable with a given name.
func (*StringParams) Set ¶
func (s *StringParams) Set(value string) error
func (*StringParams) String ¶
func (s *StringParams) String() string