Documentation
¶
Index ¶
- func Config() *viper.Viper
- func Defaults() map[string]any
- func Get[T Supported](c *viper.Viper, key string, fallback T) func() T
- func GetBool(c *viper.Viper, key string, fallback bool) func() bool
- func GetDuration(c *viper.Viper, key string, fallback time.Duration) func() time.Duration
- func GetFloat64(c *viper.Viper, key string, fallback float64) func() float64
- func GetInt(c *viper.Viper, key string, fallback int) func() int
- func GetInt32(c *viper.Viper, key string, fallback int32) func() int32
- func GetInt64(c *viper.Viper, key string, fallback int64) func() int64
- func GetIntSlice(c *viper.Viper, key string, fallback []int) func() []int
- func GetString(c *viper.Viper, key, fallback string) func() string
- func GetStringMap(c *viper.Viper, key string, fallback map[string]any) func() map[string]any
- func GetStringMapString(c *viper.Viper, key string, fallback map[string]string) func() map[string]string
- func GetStringMapStringSlice(c *viper.Viper, key string, fallback map[string][]string) func() map[string][]string
- func GetStringSlice(c *viper.Viper, key string, fallback []string) func() []string
- func GetStruct(c *viper.Viper, key string, fallback any) (func(v any) error, error)
- func GetTime(c *viper.Viper, key string, fallback time.Time) func() time.Time
- func GetUint(c *viper.Viper, key string, fallback uint) func() uint
- func GetUint32(c *viper.Viper, key string, fallback uint32) func() uint32
- func GetUint64(c *viper.Viper, key string, fallback uint64) func() uint64
- func MustGet[T Supported](c *viper.Viper, key string) func() T
- func MustGetBool(c *viper.Viper, key string) func() bool
- func MustGetDuration(c *viper.Viper, key string) func() time.Duration
- func MustGetFloat64(c *viper.Viper, key string) func() float64
- func MustGetInt(c *viper.Viper, key string) func() int
- func MustGetInt32(c *viper.Viper, key string) func() int32
- func MustGetInt64(c *viper.Viper, key string) func() int64
- func MustGetIntSlice(c *viper.Viper, key string) func() []int
- func MustGetString(c *viper.Viper, key string) func() string
- func MustGetStringMap(c *viper.Viper, key string) func() map[string]any
- func MustGetStringMapString(c *viper.Viper, key string) func() map[string]string
- func MustGetStringMapStringSlice(c *viper.Viper, key string) func() map[string][]string
- func MustGetStringSlice(c *viper.Viper, key string) func() []string
- func MustGetTime(c *viper.Viper, key string) func() time.Time
- func MustGetUint(c *viper.Viper, key string) func() uint
- func MustGetUint32(c *viper.Viper, key string) func() uint32
- func MustGetUint64(c *viper.Viper, key string) func() uint64
- func Readme() string
- func RequiredKeys() []string
- func TypeOf(key string) string
- func Types() map[string]string
- func Watch[T comparable](ctx context.Context, fn func() T, callback func(T))
- func WatchBool(ctx context.Context, fn func() bool, callback func(bool))
- func WatchBoolChan(ctx context.Context, fn func() bool, ch chan bool)
- func WatchChan[T comparable](ctx context.Context, fn func() T, ch chan T)
- func WatchDuration(ctx context.Context, fn func() time.Duration, callback func(time.Duration))
- func WatchDurationChan(ctx context.Context, fn func() time.Duration, ch chan time.Duration)
- func WatchFloat64(ctx context.Context, fn func() float64, callback func(float64))
- func WatchFloat64Chan(ctx context.Context, fn func() float64, ch chan float64)
- func WatchInt(ctx context.Context, fn func() int, callback func(int))
- func WatchInt32(ctx context.Context, fn func() int32, callback func(int32))
- func WatchInt32Chan(ctx context.Context, fn func() int32, ch chan int32)
- func WatchInt64(ctx context.Context, fn func() int64, callback func(int64))
- func WatchInt64Chan(ctx context.Context, fn func() int64, ch chan int64)
- func WatchIntChan(ctx context.Context, fn func() int, ch chan int)
- func WatchString(ctx context.Context, fn func() string, callback func(string))
- func WatchStringChan(ctx context.Context, fn func() string, ch chan string)
- func WatchTime(ctx context.Context, fn func() time.Time, callback func(time.Time))
- func WatchTimeChan(ctx context.Context, fn func() time.Time, ch chan time.Time)
- func WithRemoteConfig(c *viper.Viper, provider, endpoint string, path string) error
- type Supported
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Get ¶ added in v0.24.0
Get registers a config key with a fallback default and returns a getter closure.
func GetDuration ¶ added in v0.2.7
func GetFloat64 ¶ added in v0.2.7
func GetIntSlice ¶ added in v0.2.7
func GetStringMap ¶ added in v0.2.7
func GetStringMapString ¶ added in v0.2.7
func GetStringMapStringSlice ¶ added in v0.2.7
func GetStringSlice ¶
func MustGet ¶ added in v0.24.0
MustGet registers a required config key and returns a getter closure. Panics if the key is not set.
func MustGetDuration ¶ added in v0.2.7
func MustGetFloat64 ¶ added in v0.2.7
func MustGetIntSlice ¶ added in v0.2.7
func MustGetStringMap ¶ added in v0.2.7
func MustGetStringMapString ¶ added in v0.2.7
func MustGetStringMapStringSlice ¶ added in v0.2.7
func MustGetStringSlice ¶ added in v0.2.7
func RequiredKeys ¶ added in v0.17.0
func RequiredKeys() []string
func Watch ¶ added in v0.24.0
func Watch[T comparable](ctx context.Context, fn func() T, callback func(T))
Watch polls the getter and calls the callback when the value changes.
func WatchBoolChan ¶ added in v0.10.13
func WatchChan ¶ added in v0.24.0
func WatchChan[T comparable](ctx context.Context, fn func() T, ch chan T)
WatchChan polls the getter and sends on ch when the value changes.
func WatchDuration ¶ added in v0.10.13
func WatchDurationChan ¶ added in v0.10.13
func WatchFloat64 ¶ added in v0.10.13
func WatchFloat64Chan ¶ added in v0.10.13
func WatchInt32 ¶ added in v0.10.13
func WatchInt32Chan ¶ added in v0.10.13
func WatchInt64 ¶ added in v0.10.13
func WatchInt64Chan ¶ added in v0.10.13
func WatchIntChan ¶ added in v0.10.13
func WatchString ¶ added in v0.10.12
func WatchStringChan ¶ added in v0.10.13
func WatchTimeChan ¶ added in v0.10.13
Types ¶
type Supported ¶ added in v0.24.0
type Supported interface {
bool | int | int32 | int64 | uint | uint32 | uint64 |
float64 | string | time.Time | time.Duration |
[]int | []string |
map[string]any | map[string]string | map[string][]string
}
Supported is a type constraint for all config value types supported by viper.
Click to show internal directories.
Click to hide internal directories.