Documentation
¶
Index ¶
- type ConfigLoader
- type ConfigManager
- func (cm *ConfigManager) GetData() map[string]interface{}
- func (cm *ConfigManager) LoadEnvVariables(config *DynamicConfig) error
- func (cm *ConfigManager) LoadFromFile(filename string, config ...ConfigLoader) error
- func (cm *ConfigManager) SaveToFile(filename string, config ...ConfigSaver) error
- func (cm *ConfigManager) UpdateKey(key string, value interface{}) error
- func (cm *ConfigManager) UpdateKeys(updates map[string]interface{}) error
- type ConfigSaver
- type DynamicConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigLoader ¶
ConfigLoader interface represents the ability to load configuration data.
type ConfigManager ¶
type ConfigManager struct {
// contains filtered or unexported fields
}
ConfigManager is the primary struct for managing configuration data.
func (*ConfigManager) GetData ¶
func (cm *ConfigManager) GetData() map[string]interface{}
GetData retrieves the configuration data from ConfigManager.
func (*ConfigManager) LoadEnvVariables ¶
func (cm *ConfigManager) LoadEnvVariables(config *DynamicConfig) error
LoadEnvVariables loads configuration data from environment variables.
func (*ConfigManager) LoadFromFile ¶
func (cm *ConfigManager) LoadFromFile(filename string, config ...ConfigLoader) error
LoadFromFile loads configuration data from a file, using DynamicConfig by default if no config loader is provided.
func (*ConfigManager) SaveToFile ¶
func (cm *ConfigManager) SaveToFile(filename string, config ...ConfigSaver) error
SaveToFile saves configuration data to a file, using DynamicConfig by default if no config saver is provided.
func (*ConfigManager) UpdateKey ¶
func (cm *ConfigManager) UpdateKey(key string, value interface{}) error
UpdateKey updates a specific key in the configuration.
func (*ConfigManager) UpdateKeys ¶
func (cm *ConfigManager) UpdateKeys(updates map[string]interface{}) error
UpdateKeys updates multiple keys in the configuration.
type ConfigSaver ¶
ConfigSaver interface represents the ability to save configuration data.
type DynamicConfig ¶
DynamicConfig dynamically loads and saves configuration based on file extension.
func (*DynamicConfig) GetData ¶
func (dc *DynamicConfig) GetData() map[string]interface{}
GetData retrieves the configuration data from DynamicConfig.
func (*DynamicConfig) Load ¶
func (dc *DynamicConfig) Load(data []byte) error
Load dynamically loads configuration based on file extension.
func (*DynamicConfig) Save ¶
func (dc *DynamicConfig) Save() ([]byte, error)
Save dynamically saves configuration based on file extension.