viper

package
v0.3.21 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultFileType = "yaml"
)
View Source
const (
	DefaultReloadThreshold = 500 * time.Millisecond
)

Variables

This section is empty.

Functions

func AllKeys

func AllKeys() []string

func Get

func Get(key string) interface{}

func GetBool

func GetBool(key string) bool

func GetDuration

func GetDuration(key string) time.Duration

func GetFloat64

func GetFloat64(key string) float64

func GetInt

func GetInt(key string) int

func GetIntSlice

func GetIntSlice(key string) []int

func GetString

func GetString(key string) string

func GetStringMap

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

func GetStringMapString

func GetStringMapString(key string) map[string]string

func GetStringMapStringSlice

func GetStringMapStringSlice(key string) map[string][]string

func GetStringSlice

func GetStringSlice(key string) []string

func GetTime

func GetTime(key string) time.Time

func InConfig

func InConfig(key string) bool

func OnConfigChange

func OnConfigChange(handler func(err error))

func ReadConfig

func ReadConfig(in io.Reader) error

func ReadInConfig

func ReadInConfig() error

func Reset

func Reset()

func SafeWriteConfig

func SafeWriteConfig() error

func SafeWriteConfigAs

func SafeWriteConfigAs(file string) error

func Set

func Set(key string, value interface{})

func SetConfigFile

func SetConfigFile(file string)

func SetConfigType

func SetConfigType(fileType string)

func SetDefault

func SetDefault(key string, value interface{})

func WatchConfig

func WatchConfig()

func WriteConfig

func WriteConfig() error

func WriteConfigAs

func WriteConfigAs(file string) error

func WriteConfigTo

func WriteConfigTo(writer io.Writer) error

Types

type SafeViper

type SafeViper struct {
	// contains filtered or unexported fields
}

func NewSafeViper

func NewSafeViper() *SafeViper

NewSafeViper returns a new *SafeViper

func (*SafeViper) AllKeys

func (sv *SafeViper) AllKeys() []string

func (*SafeViper) Get

func (sv *SafeViper) Get(key string) interface{}

func (*SafeViper) GetBool

func (sv *SafeViper) GetBool(key string) bool

func (*SafeViper) GetDuration

func (sv *SafeViper) GetDuration(key string) time.Duration

func (*SafeViper) GetFloat64

func (sv *SafeViper) GetFloat64(key string) float64

func (*SafeViper) GetInt

func (sv *SafeViper) GetInt(key string) int

func (*SafeViper) GetIntSlice

func (sv *SafeViper) GetIntSlice(key string) []int

func (*SafeViper) GetString

func (sv *SafeViper) GetString(key string) string

func (*SafeViper) GetStringMap

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

func (*SafeViper) GetStringMapString

func (sv *SafeViper) GetStringMapString(key string) map[string]string

func (*SafeViper) GetStringMapStringSlice

func (sv *SafeViper) GetStringMapStringSlice(key string) map[string][]string

func (*SafeViper) GetStringSlice

func (sv *SafeViper) GetStringSlice(key string) []string

func (*SafeViper) GetTime

func (sv *SafeViper) GetTime(key string) time.Time

func (*SafeViper) InConfig

func (sv *SafeViper) InConfig(key string) bool

func (*SafeViper) OnConfigChange

func (sv *SafeViper) OnConfigChange(handler func(error))

OnConfigChange sets the config file while the config file changes

func (*SafeViper) ReadConfig

func (sv *SafeViper) ReadConfig(in io.Reader) error

ReadConfig sets the config file

func (*SafeViper) ReadInConfig

func (sv *SafeViper) ReadInConfig() error

SetConfigName sets the name of the config file

func (*SafeViper) Reset

func (sv *SafeViper) Reset()

Reset resets the config file

func (*SafeViper) SafeWriteConfig

func (sv *SafeViper) SafeWriteConfig() error

func (*SafeViper) SafeWriteConfigAs

func (sv *SafeViper) SafeWriteConfigAs(file string) error

func (*SafeViper) Set

func (sv *SafeViper) Set(key string, value interface{})

func (*SafeViper) SetConfigFile

func (sv *SafeViper) SetConfigFile(file string)

SetConfigFile sets the config file

func (*SafeViper) SetConfigType

func (sv *SafeViper) SetConfigType(fileType string)

SetConfigType sets the type of the config file

func (*SafeViper) SetDefault

func (sv *SafeViper) SetDefault(key string, value interface{})

func (*SafeViper) SetReloadThreshold

func (sv *SafeViper) SetReloadThreshold(threshold time.Duration)

SetReloadThreshold sets the reload threshold

func (*SafeViper) WatchConfig

func (sv *SafeViper) WatchConfig()

WatchConfig sets the config file

func (*SafeViper) WriteConfig

func (sv *SafeViper) WriteConfig() error

func (*SafeViper) WriteConfigAs

func (sv *SafeViper) WriteConfigAs(file string) error

func (*SafeViper) WriteConfigTo

func (sv *SafeViper) WriteConfigTo(writer io.Writer) error

Jump to

Keyboard shortcuts

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