Documentation ¶
Index ¶
- Variables
- type Config
- func (c *Config) Arg() map[string]interface{}
- func (c *Config) Clone() *Config
- func (c *Config) Data() map[string]interface{}
- func (c *Config) Env() map[string]interface{}
- func (c *Config) Flatten() map[string]interface{}
- func (c *Config) GetSection(section string) map[string]interface{}
- func (c *Config) GetSectionNames() []string
- func (c *Config) GetValue(section string, key string, i interface{}) interface{}
- func (c *Config) HasKey(section string, key string) (interface{}, bool)
- func (c *Config) HasSection(section string) (map[string]interface{}, bool)
- func (c *Config) Load() (map[string]interface{}, error)
- func (c *Config) Save() error
- func (c *Config) SetArg(in map[string]string, replacer *strings.Replacer)
- func (c *Config) SetEnv(prefixes []string, replacer *strings.Replacer)
- func (c *Config) WriteSection(section string, m map[string]interface{})
- func (c *Config) WriteValue(section string, key string, i interface{})
- type Store
Constants ¶
This section is empty.
Variables ¶
View Source
var DELIMITER string = "/"
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Store // contains filtered or unexported fields }
func New ¶
New return a configure store with map stored and file stored. And it detects file format by file name extension. JSON and TOML are supported now. Otherwise, return error.
func (*Config) GetSection ¶
func (*Config) GetSectionNames ¶
func (*Config) HasSection ¶
func (*Config) SetArg ¶
SetArg sets the map of arguments. It scans and filters all env. variable by reference mas.
func (*Config) SetEnv ¶
SetEnv sets the map of env. variable. It scans and filters all env. variable by prefix string and reference mas.
PREFIX_SECTION.KEY SetEnv([]string{"PREFIX_"}, strings.NewReplacer(".", config.DELIMITER))
func (*Config) WriteSection ¶
func (*Config) WriteValue ¶
type Store ¶
type Store interface { // Existed returns true if the file was persisted. Existed() (bool, error) // Remove removes persisted configuration file. Remove() error // String describes the backing store for the config. String() string // Close cleans up resources associated with the store. Close() error // contains filtered or unexported methods }
Click to show internal directories.
Click to hide internal directories.