Documentation ¶
Index ¶
- func Flatten(m map[string]interface{}) map[string]interface{}
- func GetValue(m map[string]interface{}, keysToFind []string) interface{}
- func MergeEnvVar(m, envVars ConfigMap) map[string]interface{}
- func MergeKeys(m1, m2 ConfigMap) map[string]interface{}
- func SetValue(m map[string]interface{}, keysToFind []string, value interface{}) map[string]interface{}
- type Config
- func (c *Config) ConfigFileMerge(s string) error
- func (c *Config) Get(k string) interface{}
- func (c *Config) LoadConfigs(configFiles ...string) (err error)
- func (c *Config) MustBool(key string, must bool) bool
- func (c *Config) MustEnvString(key, must string) string
- func (c *Config) MustInt(key string, must int) int
- func (c *Config) MustInt32(key string, must int32) int32
- func (c *Config) MustInt64(key string, must int64) int64
- func (c *Config) MustString(key, must string) string
- func (c *Config) Set(k string, v interface{})
- func (c *Config) SetConfigImpl(impl Configuration) *Config
- func (c *Config) SetConfigMap(cm ConfigMap) *Config
- func (c *Config) SetDefault(key string, val interface{})
- func (c *Config) Unmarshal(s any) error
- func (c *Config) WithEnv(envs ...string) *Config
- type ConfigMap
- type Configuration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MergeEnvVar ¶
MergeEnvVar merge Env variables into placeholders
Types ¶
type Config ¶
type Config struct { ConfigMap ConfigMap EnvConfigMap ConfigMap // contains filtered or unexported fields }
func (*Config) ConfigFileMerge ¶
ConfigFileMerge read configs from file and merge the config into ConfigMap if Key exist previosly in ConfigMap, the value will be overrided by the value from the file
func (*Config) Get ¶
Get return value from given key, and return empty string if key don't exist key can be passed in `dot-notation`
func (*Config) LoadConfigs ¶
LoadConfig is a function to load the configurations in ConfigMap
func (*Config) MustBool ¶
MustBool returns the value associated with the key as a int64 or a default value if 0.
func (*Config) MustEnvString ¶ added in v0.0.8
MustString returns the value associated with the key as a string or a default value if empty string.
func (*Config) MustInt ¶
MustInt returns the value associated with the key int or a default value if 0.
func (*Config) MustInt32 ¶
MustInt32 returns the value associated with the key as a int32 or a default value if 0.
func (*Config) MustInt64 ¶
MustInt64 returns the value associated with the key as a int64 or a default value if 0.
func (*Config) MustString ¶
MustString returns the value associated with the key as a string or a default value if empty string.
func (*Config) SetConfigImpl ¶
func (c *Config) SetConfigImpl(impl Configuration) *Config
func (*Config) SetConfigMap ¶
func (*Config) SetDefault ¶
type Configuration ¶
type Configuration interface {
SetDefaults() ConfigMap
}