Documentation ¶
Index ¶
- Constants
- Variables
- func NewJsonProvider(src interface{}) (config.ConfigInterface, error)
- type EnvProvider
- func (e *EnvProvider) GetBoolKey(key string) (bool, error)
- func (e *EnvProvider) GetConfigNode(key string) (config.ConfigInterface, error)
- func (e *EnvProvider) GetFloat64Key(key string) (float64, error)
- func (e *EnvProvider) GetIntKey(key string) (int, error)
- func (e *EnvProvider) GetKey(key string, dest interface{}) error
- func (e *EnvProvider) GetSliceKey(key, separator string) ([]string, error)
- func (e *EnvProvider) GetStringKey(key string) (string, error)
- func (e *EnvProvider) KeyExists(key string) bool
- func (e *EnvProvider) KeyListExists(keys []string) bool
- type JsonProvider
- func (j *JsonProvider) GetBoolKey(key string) (bool, error)
- func (j *JsonProvider) GetConfigNode(key string) (config.ConfigInterface, error)
- func (j *JsonProvider) GetFloat64Key(key string) (float64, error)
- func (j *JsonProvider) GetIntKey(key string) (int, error)
- func (j *JsonProvider) GetKey(key string, dest interface{}) error
- func (j *JsonProvider) GetSliceKey(key, separator string) ([]string, error)
- func (j *JsonProvider) GetStringKey(key string) (string, error)
- func (j *JsonProvider) KeyExists(key string) bool
- func (j *JsonProvider) KeyListExists(keys []string) bool
Constants ¶
View Source
const CommaSeparator = ","
View Source
const (
ErrJsonInvalidSource = utils.Error("NewJsonProvider: Invalid source type")
)
Variables ¶
View Source
var DefaultSeparator = CommaSeparator
Functions ¶
func NewJsonProvider ¶
func NewJsonProvider(src interface{}) (config.ConfigInterface, error)
Types ¶
type EnvProvider ¶
type EnvProvider struct { config.ConfigInterface // contains filtered or unexported fields }
func NewEnvProvider ¶
func NewEnvProvider(prefix string, convertCamelCase bool) *EnvProvider
NewEnvProvider builds a new config.ConfigInterface object from system Environment variables. The parameter prefix defines the key prefix to use. All existing Environment variables matching the prefix are loaded on creation. If convertCamelCase is enabled, string keys are automatically converted from camelCase format to SNAKE_CASE
func (*EnvProvider) GetBoolKey ¶
func (e *EnvProvider) GetBoolKey(key string) (bool, error)
func (*EnvProvider) GetConfigNode ¶
func (e *EnvProvider) GetConfigNode(key string) (config.ConfigInterface, error)
func (*EnvProvider) GetFloat64Key ¶
func (e *EnvProvider) GetFloat64Key(key string) (float64, error)
func (*EnvProvider) GetKey ¶
func (e *EnvProvider) GetKey(key string, dest interface{}) error
GetKey reads an env key to an interface. if dest is a pointer to a struct, key is used as a prefix, and it will attempt to extract prefix+fieldName or prefix+field_env into the different struct fields. if dest is a valid type and key is a valid env var, it will extract the env value into the var.
func (*EnvProvider) GetSliceKey ¶
func (e *EnvProvider) GetSliceKey(key, separator string) ([]string, error)
func (*EnvProvider) GetStringKey ¶
func (e *EnvProvider) GetStringKey(key string) (string, error)
func (*EnvProvider) KeyExists ¶
func (e *EnvProvider) KeyExists(key string) bool
func (*EnvProvider) KeyListExists ¶
func (e *EnvProvider) KeyListExists(keys []string) bool
type JsonProvider ¶
type JsonProvider struct { config.ConfigInterface // contains filtered or unexported fields }
func (*JsonProvider) GetBoolKey ¶
func (j *JsonProvider) GetBoolKey(key string) (bool, error)
func (*JsonProvider) GetConfigNode ¶
func (j *JsonProvider) GetConfigNode(key string) (config.ConfigInterface, error)
func (*JsonProvider) GetFloat64Key ¶
func (j *JsonProvider) GetFloat64Key(key string) (float64, error)
func (*JsonProvider) GetKey ¶
func (j *JsonProvider) GetKey(key string, dest interface{}) error
func (*JsonProvider) GetSliceKey ¶
func (j *JsonProvider) GetSliceKey(key, separator string) ([]string, error)
GetSliceKey note: separator is ignored
func (*JsonProvider) GetStringKey ¶
func (j *JsonProvider) GetStringKey(key string) (string, error)
func (*JsonProvider) KeyExists ¶
func (j *JsonProvider) KeyExists(key string) bool
func (*JsonProvider) KeyListExists ¶
func (j *JsonProvider) KeyListExists(keys []string) bool
Click to show internal directories.
Click to hide internal directories.