config

package
v0.0.0-...-c54e3d4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2019 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

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 FromCache

func FromCache(key string) (interface{}, bool)

FromCache returns the cached value for a key

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 GetBool

func GetBool(key string) bool

GetBool returns the value associated with the key as a boolean.

func GetDuration

func GetDuration(key string) time.Duration

GetDuration returns the value associated with the key as a duration.

func GetFloat64

func GetFloat64(key string) float64

GetFloat64 returns the value associated with the key as a float64.

func GetInt

func GetInt(key string) int

GetInt returns the value associated with the key as an integer.

func GetString

func GetString(key string) string

GetString returns the value associated with the key as a string.

func GetStringMap

func GetStringMap(key string) map[string]interface{}

GetStringMap returns the value associated with the key as a map of interfaces.

func GetStringMapString

func GetStringMapString(key string) map[string]string

GetStringMapString returns the value associated with the key as a map of strings.

func GetStringMapSub

func GetStringMapSub(key string, withDefaultsApplied bool) map[string]*viper.Viper

GetStringMapSub returns a map of subtrees at a key can also apply defaults if required

func GetStringSlice

func GetStringSlice(key string) []string

GetStringSlice returns the value associated with the key as a slice of strings.

func GetSub

func GetSub(key string) *viper.Viper

Sub returns new Viper instance representing a sub tree of this instance. Sub is case-insensitive for a key.

func GetTime

func GetTime(key string) time.Time

GetTime returns the value associated with the key as time.

func IsSet

func IsSet(key string) bool

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

func MemoizedFn(key string, keyPrefix string, fn func(string) interface{}) interface{}

MemoizedFn stores the result of the function in the cache and returns it on subsequent calls

func ToCache

func ToCache(key string, value interface{})

ToCache stores a value to cache at a key

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL