internal

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

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 NewConfig

func NewConfig() *Config

NewConfig creates a new configuration structure

func (*Config) Get

func (config *Config) Get(key string) (interface{}, error)

Get gets a key from the loaded configuration

func (*Config) GetBoolean

func (config *Config) GetBoolean(key string) (bool, error)

GetBoolean gets a boolean from the loaded configuration

func (*Config) GetBooleanSlice

func (config *Config) GetBooleanSlice(key string) ([]bool, error)

GetBooleanSlice gets a boolean slice from the loaded configuration

func (*Config) GetFloat

func (config *Config) GetFloat(key string) (float64, error)

GetFloat gets a float from the loaded configuration

func (*Config) GetFloatSlice

func (config *Config) GetFloatSlice(key string) ([]float64, error)

GetFloatSlice gets a float slice from the loaded configuration

func (*Config) GetInteger

func (config *Config) GetInteger(key string) (int, error)

GetInteger gets a integer from the loaded configuration

func (*Config) GetIntegerSlice

func (config *Config) GetIntegerSlice(key string) ([]int, error)

GetIntegerSlice gets a integer slice from the loaded configuration

func (*Config) GetMap

func (config *Config) GetMap(key string) (map[string]interface{}, error)

GetMap gets a map from the loaded configuration

func (*Config) GetSlice

func (config *Config) GetSlice(key string) ([]interface{}, error)

GetSlice gets a slice from the loaded configuration

func (*Config) GetString

func (config *Config) GetString(key string) (string, error)

GetString gets a string from the loaded configuration

func (*Config) GetStringSlice

func (config *Config) GetStringSlice(key string) ([]string, error)

GetStringSlice gets a string slice from the loaded configuration

func (*Config) GetSubConfig

func (config *Config) GetSubConfig(key string) (*Config, error)

GetSubConfig gets a loaded submap as a configuration structure

func (*Config) Set

func (config *Config) Set(key string, value interface{}) error

Set sets a value in the loaded configuration

func (*Config) ToStructure

func (config *Config) ToStructure(structure interface{}) error

ToStructure maps the loaded configuration to a structure

func (*Config) Use

func (config *Config) Use(loader Loader)

Use adds a loader to the configuration loading chain

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 Loader

type Loader interface {
	Load() (map[string]interface{}, error)
}

Loader defines a generic loader interface

type MapLoader

type MapLoader struct {
	// contains filtered or unexported fields
}

MapLoader defines a loader that loads configurations from a map

func NewMapLoader

func NewMapLoader(stringMap map[string]interface{}) *MapLoader

NewMapLoader creates a new map loader

func (*MapLoader) Load

func (loader *MapLoader) Load() (map[string]interface{}, error)

Load returns the underlying map

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL