Documentation ¶
Index ¶
- func LoadDefaults(defaults map[string]interface{}, prefix string)
- func MustGet[T comparable](key string, getter func(string) T) T
- func MustGetAny(key string) interface{}
- func MustGetBool(key string) bool
- func MustGetFloat64(key string) float64
- func MustGetInt(key string) int
- func MustGetInt64(key string) int64
- func MustGetOrError[T comparable](key string, getter func(string) T) (val T, err error)
- func MustGetString(key string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadDefaults ¶
LoadDefaults loads the default configuration values provided as a map into Viper. It sets the environment prefix and key replacer for Viper to handle environment variables.
func MustGet ¶
func MustGet[T comparable](key string, getter func(string) T) T
MustGet retrieves the value associated with the given key using the provided getter function from Viper. It panics if the value is not found.
func MustGetAny ¶
func MustGetAny(key string) interface{}
MustGetAny retrieves the value associated with the given key as an interface{} from Viper. It uses the MustGet function to retrieve the value and panics if the value is not found. The retrieved value is returned as an interface{} type, allowing flexibility in handling different types of values.
func MustGetBool ¶
MustGetBool retrieves the value associated with the given key as a bool from Viper. It uses the MustGet function to retrieve the value and panics if the value is not found.
func MustGetFloat64 ¶
MustGetFloat64 retrieves the value associated with the given key as a float64 from Viper. It uses the MustGet function to retrieve the value and panics if the value is not found.
func MustGetInt ¶
MustGetInt retrieves the value associated with the given key as an int from Viper. It uses the MustGet function to retrieve the value and panics if the value is not found.
func MustGetInt64 ¶
MustGetInt64 retrieves the value associated with the given key as an int64 from Viper. It uses the MustGet function to retrieve the value and panics if the value is not found.
func MustGetOrError ¶
func MustGetOrError[T comparable](key string, getter func(string) T) (val T, err error)
MustGetOrError retrieves the value associated with the given key using the provided getter function from Viper. It returns an error if the value is not found.
func MustGetString ¶
MustGetString retrieves the value associated with the given key as a string from Viper. It uses the MustGet function to retrieve the value and panics if the value is not found.
Types ¶
This section is empty.