Documentation
¶
Index ¶
- func ParseValue(value string) string
- type Config
- func (c *Config) Bool(args ...interface{}) bool
- func (c *Config) Fetch(args ...interface{}) string
- func (c *Config) Get(args ...interface{}) string
- func (c *Config) GetConf(args ...interface{}) string
- func (c *Config) GetEnv(args ...interface{}) string
- func (c *Config) GetSection(section string) Section
- func (c *Config) Getenv(key interface{}) string
- func (c *Config) Getkey(key interface{}) string
- func (c *Config) Int(args ...interface{}) int64
- func (c *Config) List() []string
- func (c *Config) Put(args ...interface{})
- func (c *Config) Save()
- func (c *Config) Setenv(key, value interface{})
- func (c *Config) String(args ...interface{}) string
- func (c *Config) Uint(args ...interface{}) uint64
- type Section
- func (sec *Section) Bool(args ...interface{}) bool
- func (sec *Section) Fetch(args ...interface{}) string
- func (sec *Section) Get(args ...interface{}) string
- func (sec *Section) GetConf(args ...interface{}) string
- func (sec *Section) GetEnv(args ...interface{}) string
- func (sec *Section) Getenv(key interface{}) string
- func (sec *Section) Getkey(key interface{}) string
- func (sec *Section) Int(args ...interface{}) int64
- func (sec *Section) List() []string
- func (sec *Section) Put(args ...interface{})
- func (sec *Section) Setenv(key, value interface{})
- func (sec *Section) String(args ...interface{}) string
- func (sec *Section) Uint(args ...interface{}) uint64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseValue ¶ added in v0.0.3
ParseValue will parse config from raw string
Types ¶
type Config ¶
Config struct has map to contains secions and an attribute to indicate the current section
func NewEmptyConfig ¶ added in v0.0.4
func NewEmptyConfig() *Config
NewEmptyConfig creates an empty Config instance
func (*Config) Bool ¶ added in v0.0.4
Bool parse env value as bool
args set: (name) args set: (name, defaultValue)
func (*Config) Fetch ¶
Feth will get key values from config
At least the key name should be provided ¶
Parameter sets: conf_key
Parameter sets: conf_key, env_key
Parameter sets: conf_key, env_key, default_value
When env_key is provided it will try to fetch env variable only if the value of conf_key is empty
func (*Config) Get ¶
Get will get key values from config
At least the key name should be provided ¶
Parameter sets: conf_key
Parameter sets: env_key, conf_key
Parameter sets: env_key, conf_key, default_value
When env_key is provided it will try to fetch env variable first, if it's empty, it will try to get it from config
func (*Config) GetConf ¶
GetConf will get key values from config
At least the key name should be provided ¶
Parameter sets: conf_key
Parameter sets: conf_key, default_value
func (*Config) GetEnv ¶
GetEnv will get key values from env
At least the key name should be provided ¶
Parameter sets: env_key
Parameter sets: env_key, default_value
func (*Config) GetSection ¶
GetSection gets config section with name
func (*Config) Int ¶ added in v0.0.4
Int parse env value as int64
args set: (name) args set: (name, defaultValue)
func (*Config) Setenv ¶
func (c *Config) Setenv(key, value interface{})
Setenv is a sugar for config object to set env
type Section ¶
type Section map[string]interface{}
Section is a based on map
func NewSection ¶
NewSection will create new section in config
func (*Section) Bool ¶ added in v0.0.4
Bool parse env value as bool
args set: (name) args set: (name, defaultValue)
func (*Section) Get ¶
Get will get config key, args pattern: envKey, configKey, defaultValue or just configKey
func (*Section) Int ¶ added in v0.0.4
Int parse env value as int64
args set: (name) args set: (name, defaultValue)
func (*Section) Put ¶
func (sec *Section) Put(args ...interface{})
Put will add new key with or without value
func (*Section) Setenv ¶
func (sec *Section) Setenv(key, value interface{})
Setenv is a sugar for section object to set env