Documentation ¶
Overview ¶
Package xml for config provider.
depend on github.com/beego/x2j.
go install github.com/beego/x2j.
Usage:
import( _ "github.com/ECacheFS/beego/config/xml" "github.com/ECacheFS/beego/config" ) cnf, err := config.NewConfig("xml", "config.xml")
More docs http://beego.me/docs/module/config.md
Index ¶
- type Config
- type ConfigContainer
- func (c *ConfigContainer) Bool(key string) (bool, error)
- func (c *ConfigContainer) DIY(key string) (v interface{}, err error)
- func (c *ConfigContainer) DefaultBool(key string, defaultval bool) bool
- func (c *ConfigContainer) DefaultFloat(key string, defaultval float64) float64
- func (c *ConfigContainer) DefaultInt(key string, defaultval int) int
- func (c *ConfigContainer) DefaultInt64(key string, defaultval int64) int64
- func (c *ConfigContainer) DefaultString(key string, defaultval string) string
- func (c *ConfigContainer) DefaultStrings(key string, defaultval []string) []string
- func (c *ConfigContainer) Float(key string) (float64, error)
- func (c *ConfigContainer) GetSection(section string) (map[string]string, error)
- func (c *ConfigContainer) Int(key string) (int, error)
- func (c *ConfigContainer) Int64(key string) (int64, error)
- func (c *ConfigContainer) SaveConfigFile(filename string) (err error)
- func (c *ConfigContainer) Set(key, val string) error
- func (c *ConfigContainer) String(key string) string
- func (c *ConfigContainer) Strings(key string) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v1.6.0
type Config struct{}
Config is a xml config parser and implements Config interface. xml configurations should be included in <config></config> tag. only support key/value pair as <key>value</key> as each item.
type ConfigContainer ¶ added in v1.6.0
ConfigContainer A Config represents the xml configuration.
func (*ConfigContainer) Bool ¶ added in v1.6.0
func (c *ConfigContainer) Bool(key string) (bool, error)
Bool returns the boolean value for a given key.
func (*ConfigContainer) DIY ¶ added in v1.6.0
func (c *ConfigContainer) DIY(key string) (v interface{}, err error)
DIY returns the raw value by a given key.
func (*ConfigContainer) DefaultBool ¶ added in v1.6.0
func (c *ConfigContainer) DefaultBool(key string, defaultval bool) bool
DefaultBool return the bool value if has no error otherwise return the defaultval
func (*ConfigContainer) DefaultFloat ¶ added in v1.6.0
func (c *ConfigContainer) DefaultFloat(key string, defaultval float64) float64
DefaultFloat returns the float64 value for a given key. if err != nil return defaultval
func (*ConfigContainer) DefaultInt ¶ added in v1.6.0
func (c *ConfigContainer) DefaultInt(key string, defaultval int) int
DefaultInt returns the integer value for a given key. if err != nil return defaultval
func (*ConfigContainer) DefaultInt64 ¶ added in v1.6.0
func (c *ConfigContainer) DefaultInt64(key string, defaultval int64) int64
DefaultInt64 returns the int64 value for a given key. if err != nil return defaultval
func (*ConfigContainer) DefaultString ¶ added in v1.6.0
func (c *ConfigContainer) DefaultString(key string, defaultval string) string
DefaultString returns the string value for a given key. if err != nil return defaultval
func (*ConfigContainer) DefaultStrings ¶ added in v1.6.0
func (c *ConfigContainer) DefaultStrings(key string, defaultval []string) []string
DefaultStrings returns the []string value for a given key. if err != nil return defaultval
func (*ConfigContainer) Float ¶ added in v1.6.0
func (c *ConfigContainer) Float(key string) (float64, error)
Float returns the float value for a given key.
func (*ConfigContainer) GetSection ¶ added in v1.6.0
func (c *ConfigContainer) GetSection(section string) (map[string]string, error)
GetSection returns map for the given section
func (*ConfigContainer) Int ¶ added in v1.6.0
func (c *ConfigContainer) Int(key string) (int, error)
Int returns the integer value for a given key.
func (*ConfigContainer) Int64 ¶ added in v1.6.0
func (c *ConfigContainer) Int64(key string) (int64, error)
Int64 returns the int64 value for a given key.
func (*ConfigContainer) SaveConfigFile ¶ added in v1.6.0
func (c *ConfigContainer) SaveConfigFile(filename string) (err error)
SaveConfigFile save the config into file
func (*ConfigContainer) Set ¶ added in v1.6.0
func (c *ConfigContainer) Set(key, val string) error
Set writes a new value for key.
func (*ConfigContainer) String ¶ added in v1.6.0
func (c *ConfigContainer) String(key string) string
String returns the string value for a given key.
func (*ConfigContainer) Strings ¶ added in v1.6.0
func (c *ConfigContainer) Strings(key string) []string
Strings returns the []string value for a given key.