vipertools

package
v1.130.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2025 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FirstNonEmptyBool

func FirstNonEmptyBool(v *viper.Viper, keys ...string) bool

FirstNonEmptyBool accepts multiple keys and returns the first non-empty bool value from viper.Viper via these keys. Non-empty meaning key not set will not be accepted. Will return false as second parameter, if non-empty bool value could not be retrieved.

func FirstNonEmptyInt

func FirstNonEmptyInt(v *viper.Viper, keys ...string) (int, bool)

FirstNonEmptyInt accepts multiple keys and returns the first non-empty int value from viper.Viper via these keys. Non-empty meaning key not set will not be accepted. Will return false as second parameter, if non-empty int value could not be retrieved.

func FirstNonEmptyString

func FirstNonEmptyString(v *viper.Viper, keys ...string) string

FirstNonEmptyString accepts multiple keys and returns the first non-empty string value from viper.Viper via these keys. Returns empty string by default if a value couldn't be found.

func GetString added in v1.7.1

func GetString(v *viper.Viper, key string) string

GetString gets a parameter/setting by key and strips any quotes.

func GetStringMapString added in v1.42.1

func GetStringMapString(v *viper.Viper, prefix string) map[string]string

GetStringMapString gets a parameter/setting by key prefix and strips any quotes.

func MustNew added in v1.123.0

func MustNew() *viper.Viper

MustNew creates a new viper instance with the ini codec registered and panics if it fails. This is useful for testing.

func New added in v1.123.0

func New() (*viper.Viper, error)

New creates a new viper instance with the ini codec registered.

Types

This section is empty.

Jump to

Keyboard shortcuts

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