Documentation ¶
Index ¶
- Variables
- func Get(key string) interface{}
- func GetBool(key string) bool
- func GetDuration(key string) time.Duration
- func GetFloat64(key string) float64
- func GetInt(key string) int
- func GetInt64(key string) int64
- func GetSlice(key string) []interface{}
- func GetString(key string) string
- func GetStringMap(key string) map[string]interface{}
- func GetStringMapString(key string) map[string]string
- func GetStringMapStringSlice(key string) map[string][]string
- func GetStringSlice(key string) []string
- func GetTime(key string) time.Time
- func InitConfig(opts ...*Option) (err error)
- func OnChange(fn func(*Config))
- func SetOverride(key string, val interface{}) error
- func UnmarshalKey(key string, rawVal interface{}) error
- func UnmarshalWithExpect(key string, expect interface{}) interface{}
- type Config
- func (c *Config) Get(key string) interface{}
- func (c *Config) GetBool(key string) bool
- func (c *Config) GetDuration(key string) time.Duration
- func (c *Config) GetFloat64(key string) float64
- func (c *Config) GetInt(key string) int
- func (c *Config) GetInt64(key string) int64
- func (c *Config) GetSlice(key string) []interface{}
- func (c *Config) GetSliceStringMap(key string) []map[string]interface{}
- func (c *Config) GetString(key string) string
- func (c *Config) GetStringMap(key string) map[string]interface{}
- func (c *Config) GetStringMapString(key string) map[string]string
- func (c *Config) GetStringMapStringSlice(key string) map[string][]string
- func (c *Config) GetStringSlice(key string) []string
- func (c *Config) GetTime(key string) time.Time
- func (c *Config) UnmarshalKey(key string, rawVal interface{}) error
- func (c *Config) UnmarshalWithExpect(key string, expect interface{}) interface{}
- type Option
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidKey = errors.New("invalid key")
ErrInvalidKey ...
Functions ¶
func GetBool ¶
GetBool returns the value associated with the key as a boolean with default defaultConfig.
func GetDuration ¶
GetDuration returns the value associated with the key as a duration with default defaultConfig.
func GetFloat64 ¶
GetFloat64 returns the value associated with the key as a float64 with default defaultConfig.
func GetInt ¶
GetInt returns the value associated with the key as an integer with default defaultConfig.
func GetInt64 ¶
GetInt64 returns the value associated with the key as an integer with default defaultConfig.
func GetSlice ¶
func GetSlice(key string) []interface{}
GetSlice returns the value associated with the key as a slice of strings with default defaultConfig.
func GetString ¶
GetString returns the value associated with the key as a string with default defaultConfig.
func GetStringMap ¶
GetStringMap returns the value associated with the key as a map of interfaces with default defaultConfig.
func GetStringMapString ¶
GetStringMapString returns the value associated with the key as a map of strings with default defaultConfig.
func GetStringMapStringSlice ¶
GetStringMapStringSlice returns the value associated with the key as a map to a slice of strings with default defaultConfig.
func GetStringSlice ¶
GetStringSlice returns the value associated with the key as a slice of strings with default defaultConfig.
func GetTime ¶
GetTime returns the value associated with the key as time with default defaultConfig.
func InitConfig ¶
New constructs a new Config with provider.
func SetOverride ¶
func UnmarshalKey ¶
UnmarshalKey takes a single key and unmarshal it into a Struct with default defaultdefaultConfig.
func UnmarshalWithExpect ¶
func UnmarshalWithExpect(key string, expect interface{}) interface{}
UnmarshalWithExpect unmarshal key, returns expect if failed
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config provides Config for application.
func (*Config) GetDuration ¶
GetDuration returns the value associated with the key as a duration.
func (*Config) GetFloat64 ¶
GetFloat64 returns the value associated with the key as a float64.
func (*Config) GetSliceStringMap ¶
GetSliceStringMap returns the value associated with the slice of maps.
func (*Config) GetStringMap ¶
GetStringMap returns the value associated with the key as a map of interfaces.
func (*Config) GetStringMapString ¶
GetStringMapString returns the value associated with the key as a map of strings.
func (*Config) GetStringMapStringSlice ¶
GetStringMapStringSlice returns the value associated with the key as a map to a slice of strings.
func (*Config) GetStringSlice ¶
GetStringSlice returns the value associated with the key as a slice of strings.
func (*Config) UnmarshalKey ¶
UnmarshalKey takes a single key and unmarshal it into a Struct.
func (*Config) UnmarshalWithExpect ¶
UnmarshalWithExpect unmarshal key, returns expect if failed
type Option ¶
type Option struct {
Source source.ConfSource
}
func SetSource ¶
func SetSource(s source.ConfSource) *Option