Documentation
¶
Index ¶
- func All() map[string]interface{}
- func FromCache(key string) (interface{}, bool)
- 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 GetString(key string) string
- func GetStringMap(key string) map[string]interface{}
- func GetStringMapString(key string) map[string]string
- func GetStringMapSub(key string, withDefaultsApplied bool) map[string]*viper.Viper
- func GetStringSlice(key string) []string
- func GetSub(key string) *viper.Viper
- func GetTime(key string) time.Time
- func IsSet(key string) bool
- func LoadDefaults()
- func MemoizedFn(key string, keyPrefix string, fn func(string) interface{}) interface{}
- func ToCache(key string, value interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func All ¶
func All() map[string]interface{}
All merges all settings and returns them as a map[string]interface{}.
func Get ¶
func Get(key string) interface{}
Get can retrieve any value given the key to use. Get is case-insensitive for a key. Get has the behavior of returning the value associated with the first place from where it is set. Viper will check in the following order: override, flag, env, config file, key/value store, default
Get returns an interface. For a specific value use one of the Get____ methods.
func GetDuration ¶
GetDuration returns the value associated with the key as a duration.
func GetFloat64 ¶
GetFloat64 returns the value associated with the key as a float64.
func GetStringMap ¶
GetStringMap returns the value associated with the key as a map of interfaces.
func GetStringMapString ¶
GetStringMapString returns the value associated with the key as a map of strings.
func GetStringMapSub ¶
GetStringMapSub returns a map of subtrees at a key can also apply defaults if required
func GetStringSlice ¶
GetStringSlice returns the value associated with the key as a slice of strings.
func GetSub ¶
Sub returns new Viper instance representing a sub tree of this instance. Sub is case-insensitive for a key.
func IsSet ¶
IsSet checks to see if the key has been set in any of the data locations. IsSet is case-insensitive for a key.
func LoadDefaults ¶
func LoadDefaults()
LoadDefaults replaces the defaults with their resolved values so that they can be used in other parts directly
func MemoizedFn ¶
MemoizedFn stores the result of the function in the cache and returns it on subsequent calls
Types ¶
This section is empty.