Documentation ¶
Index ¶
- type ArgumentLoader
- type Config
- func (config *Config) Get(key string) (interface{}, error)
- func (config *Config) GetBoolean(key string) (bool, error)
- func (config *Config) GetBooleanSlice(key string) ([]bool, error)
- func (config *Config) GetFloat(key string) (float64, error)
- func (config *Config) GetFloatSlice(key string) ([]float64, error)
- func (config *Config) GetInteger(key string) (int, error)
- func (config *Config) GetIntegerSlice(key string) ([]int, error)
- func (config *Config) GetMap(key string) (map[string]interface{}, error)
- func (config *Config) GetSlice(key string) ([]interface{}, error)
- func (config *Config) GetString(key string) (string, error)
- func (config *Config) GetStringSlice(key string) ([]string, error)
- func (config *Config) GetSubConfig(key string) (*Config, error)
- func (config *Config) Set(key string, value interface{}) error
- func (config *Config) ToStructure(structure interface{}) error
- func (config *Config) Use(loader Loader)
- type EnvironmentLoader
- type JSONFileLoader
- type Loader
- type MapLoader
- type YAMLFileLoader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArgumentLoader ¶
type ArgumentLoader struct {
// contains filtered or unexported fields
}
ArgumentLoader defines a loader that loads configuration from command line arguments
func NewArgumentLoader ¶
func NewArgumentLoader(separator string, prefix string) *ArgumentLoader
NewArgumentLoader creates a new argument loader
func (*ArgumentLoader) Load ¶
func (loader *ArgumentLoader) Load() (map[string]interface{}, error)
Load loads environment variables into a configuration map
type Config ¶
type Config struct {
Map map[string]interface{}
}
Config defines the overall configuration structure
func (*Config) GetBoolean ¶
GetBoolean gets a boolean from the loaded configuration
func (*Config) GetBooleanSlice ¶
GetBooleanSlice gets a boolean slice from the loaded configuration
func (*Config) GetFloatSlice ¶
GetFloatSlice gets a float slice from the loaded configuration
func (*Config) GetInteger ¶
GetInteger gets a integer from the loaded configuration
func (*Config) GetIntegerSlice ¶
GetIntegerSlice gets a integer slice from the loaded configuration
func (*Config) GetStringSlice ¶
GetStringSlice gets a string slice from the loaded configuration
func (*Config) GetSubConfig ¶
GetSubConfig gets a loaded submap as a configuration structure
func (*Config) ToStructure ¶
ToStructure maps the loaded configuration to a structure
type EnvironmentLoader ¶
type EnvironmentLoader struct {
// contains filtered or unexported fields
}
EnvironmentLoader defines a loader that loads configurations from environment variables
func NewEnvironmentLoader ¶
func NewEnvironmentLoader(lowerCase bool, separator string, prefix string) *EnvironmentLoader
NewEnvironmentLoader creates a new environment loader
func (*EnvironmentLoader) Load ¶
func (loader *EnvironmentLoader) Load() (map[string]interface{}, error)
Load loads environment variables
type JSONFileLoader ¶
type JSONFileLoader struct {
// contains filtered or unexported fields
}
JSONFileLoader defines a loader that loads configurations from a JSON file
func NewJSONFileLoader ¶
func NewJSONFileLoader(filePath string, parseDurations bool) *JSONFileLoader
NewJSONFileLoader creates a new JSON file loader
func (*JSONFileLoader) Load ¶
func (loader *JSONFileLoader) Load() (map[string]interface{}, error)
Load loads a JSON file
type MapLoader ¶
type MapLoader struct {
// contains filtered or unexported fields
}
MapLoader defines a loader that loads configurations from a map
func NewMapLoader ¶
NewMapLoader creates a new map loader
type YAMLFileLoader ¶
type YAMLFileLoader struct {
// contains filtered or unexported fields
}
YAMLFileLoader defines a loader that loads configurations from a YAML file
func NewYAMLFileLoader ¶
func NewYAMLFileLoader(filePath string, parseDurations bool) *YAMLFileLoader
NewYAMLFileLoader creates a new YAML file loader
func (*YAMLFileLoader) Load ¶
func (loader *YAMLFileLoader) Load() (map[string]interface{}, error)
Load loads a YAML file