Documentation ¶
Index ¶
- func ToStruct[T any](cfg *Config, key string) (t T, err error)
- type Config
- func (g *Config) Exists(key string) bool
- func (g *Config) Get(key string) any
- func (g *Config) GetBool(k string) bool
- func (g *Config) GetDuration(k string) time.Duration
- func (g *Config) GetFloat64(k string) float64
- func (g *Config) GetInt(k string) int
- func (g *Config) GetInt32(k string) int32
- func (g *Config) GetInt64(k string) int64
- func (g *Config) GetIntSlice(k string) []int
- func (g *Config) GetString(k string) string
- func (g *Config) GetStringMap(k string) map[string]any
- func (g *Config) GetStringSlice(k string) []string
- func (g *Config) GetTime(k string) time.Time
- func (g *Config) Of(prefix string) *Config
- func (g *Config) Set(key string, value any)
- func (g *Config) SetDefault(key string, value any)
- type Wrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is a higher-level Viper wrapper that comes with some extra features
func NewConfigFromPaths ¶
NewConfigFromPaths construct a config from paths
func (*Config) GetFloat64 ¶
func (*Config) GetIntSlice ¶
func (*Config) GetStringSlice ¶
func (*Config) Of ¶
Of returns a new config instance with provided key prefix Example:
cfg.GetString("foo.bar") == cfg.Of("foo").GetString("bar") // true
func (*Config) SetDefault ¶
Click to show internal directories.
Click to hide internal directories.