Documentation ¶
Overview ¶
Go with Config
Modular configuration management in Go, redesigned.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Modules []*Module
}
Type Config defines a manager of modular configuration. It is a struct with Modules property as a slice of Module pointer.
func (*Config) AppendModule ¶
Appends a module configuration to the Config pointer and returns the Config pointer for chain-able functions call purposes.
func (*Config) CreateModule ¶
Creates a named module configuration, appends it to the Config, and returns the Module pointer.
func (*Config) DeleteModule ¶
Deletes a named module configuration from the Config pointer and returns the Config pointer for chain-able functions call purposes.
func (*Config) IsModuleExists ¶
Checks whether a named module configuration is exists in the Modules slice in the Config pointer. Returns true if the named module is exists, and false otherwise.
func (*Config) OnModule ¶
Get a named module configuration from the Config pointer. If the module configuration with specified name does not exist in the Config's Modules slice, it will then try to create a new Module with that name, so that the returns value is predicted will not be nil. Returns a Module pointer.
type Module ¶
Type Module defines a named modular configuration.
Property Name defines the Module's Name as string. Property Config defines the key-value pair of configuration list as map string of string.
func (*Module) Delete ¶
Delete module configuration with specified key. Returns the Module for function call chaining purpose.
func (*Module) Get ¶
Get module configuration with specified key. Returns the string value of the module configuration. When no configuration is saved with that specified key, it will returns an empty string.
func (*Module) GetWithDefault ¶
The same as Get(key string), but it will returns defaultValue instead of empty string when no configuration is saved with that specified key.