Documentation ¶
Index ¶
- type JSONConfig
- type JSONConfigContainer
- func (c *JSONConfigContainer) Bool(key string) (bool, error)
- func (c *JSONConfigContainer) DIY(key string) (v interface{}, err error)
- func (c *JSONConfigContainer) DefaultBool(key string, defaultVal bool) bool
- func (c *JSONConfigContainer) DefaultFloat(key string, defaultVal float64) float64
- func (c *JSONConfigContainer) DefaultInt(key string, defaultVal int) int
- func (c *JSONConfigContainer) DefaultInt64(key string, defaultVal int64) int64
- func (c *JSONConfigContainer) DefaultString(key string, defaultVal string) string
- func (c *JSONConfigContainer) DefaultStrings(key string, defaultVal []string) []string
- func (c *JSONConfigContainer) Float(key string) (float64, error)
- func (c *JSONConfigContainer) GetSection(section string) (map[string]string, error)
- func (c *JSONConfigContainer) Int(key string) (int, error)
- func (c *JSONConfigContainer) Int64(key string) (int64, error)
- func (c *JSONConfigContainer) OnChange(key string, fn func(value string))
- func (c *JSONConfigContainer) SaveConfigFile(filename string) (err error)
- func (c *JSONConfigContainer) Set(key, val string) error
- func (c *JSONConfigContainer) String(key string) (string, error)
- func (c *JSONConfigContainer) Strings(key string) ([]string, error)
- func (c *JSONConfigContainer) Sub(key string) (config.Configer, error)
- func (c *JSONConfigContainer) Unmarshaler(prefix string, obj interface{}, opt ...config.DecodeOption) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JSONConfig ¶
type JSONConfig struct{}
JSONConfig is a json config parser and implements Config interface.
type JSONConfigContainer ¶
JSONConfigContainer is a config which represents the json configuration. Only when get value, support key as section:name type.
func (*JSONConfigContainer) Bool ¶
func (c *JSONConfigContainer) Bool(key string) (bool, error)
Bool returns the boolean value for a given key.
func (*JSONConfigContainer) DIY ¶
func (c *JSONConfigContainer) DIY(key string) (v interface{}, err error)
DIY returns the raw value by a given key.
func (*JSONConfigContainer) DefaultBool ¶
func (c *JSONConfigContainer) DefaultBool(key string, defaultVal bool) bool
DefaultBool return the bool value if has no error otherwise return the defaultval
func (*JSONConfigContainer) DefaultFloat ¶
func (c *JSONConfigContainer) DefaultFloat(key string, defaultVal float64) float64
DefaultFloat returns the float64 value for a given key. if err != nil return defaultval
func (*JSONConfigContainer) DefaultInt ¶
func (c *JSONConfigContainer) DefaultInt(key string, defaultVal int) int
DefaultInt returns the integer value for a given key. if err != nil return defaultval
func (*JSONConfigContainer) DefaultInt64 ¶
func (c *JSONConfigContainer) DefaultInt64(key string, defaultVal int64) int64
DefaultInt64 returns the int64 value for a given key. if err != nil return defaultval
func (*JSONConfigContainer) DefaultString ¶
func (c *JSONConfigContainer) DefaultString(key string, defaultVal string) string
DefaultString returns the string value for a given key. if err != nil return defaultval
func (*JSONConfigContainer) DefaultStrings ¶
func (c *JSONConfigContainer) DefaultStrings(key string, defaultVal []string) []string
DefaultStrings returns the []string value for a given key. if err != nil return defaultval
func (*JSONConfigContainer) Float ¶
func (c *JSONConfigContainer) Float(key string) (float64, error)
Float returns the float value for a given key.
func (*JSONConfigContainer) GetSection ¶
func (c *JSONConfigContainer) GetSection(section string) (map[string]string, error)
GetSection returns map for the given section
func (*JSONConfigContainer) Int ¶
func (c *JSONConfigContainer) Int(key string) (int, error)
Int returns the integer value for a given key.
func (*JSONConfigContainer) Int64 ¶
func (c *JSONConfigContainer) Int64(key string) (int64, error)
Int64 returns the int64 value for a given key.
func (*JSONConfigContainer) OnChange ¶
func (c *JSONConfigContainer) OnChange(key string, fn func(value string))
func (*JSONConfigContainer) SaveConfigFile ¶
func (c *JSONConfigContainer) SaveConfigFile(filename string) (err error)
SaveConfigFile save the config into file
func (*JSONConfigContainer) Set ¶
func (c *JSONConfigContainer) Set(key, val string) error
Set writes a new value for key.
func (*JSONConfigContainer) String ¶
func (c *JSONConfigContainer) String(key string) (string, error)
String returns the string value for a given key.
func (*JSONConfigContainer) Strings ¶
func (c *JSONConfigContainer) Strings(key string) ([]string, error)
Strings returns the []string value for a given key.
func (*JSONConfigContainer) Sub ¶
func (c *JSONConfigContainer) Sub(key string) (config.Configer, error)
func (*JSONConfigContainer) Unmarshaler ¶
func (c *JSONConfigContainer) Unmarshaler(prefix string, obj interface{}, opt ...config.DecodeOption) error