Documentation ¶
Overview ¶
package xml for config provider
depend on github.com/beego/x2j
go install github.com/beego/x2j
Usage: import(
_ "github.com/astaxie/beego/config/xml" "github.com/astaxie/beego/config"
)
cnf, err := config.NewConfig("xml", "config.xml") more docs http://beego.me/docs/module/config.md
Index ¶
- type XMLConfig
- type XMLConfigContainer
- func (c *XMLConfigContainer) Bool(key string) (bool, error)
- func (c *XMLConfigContainer) DIY(key string) (v interface{}, err error)
- func (c *XMLConfigContainer) DefaultBool(key string, defaultval bool) bool
- func (c *XMLConfigContainer) DefaultFloat(key string, defaultval float64) float64
- func (c *XMLConfigContainer) DefaultInt(key string, defaultval int) int
- func (c *XMLConfigContainer) DefaultInt64(key string, defaultval int64) int64
- func (c *XMLConfigContainer) DefaultString(key string, defaultval string) string
- func (c *XMLConfigContainer) DefaultStrings(key string, defaultval []string) []string
- func (c *XMLConfigContainer) Float(key string) (float64, error)
- func (c *XMLConfigContainer) GetSection(section string) (map[string]string, error)
- func (c *XMLConfigContainer) Int(key string) (int, error)
- func (c *XMLConfigContainer) Int64(key string) (int64, error)
- func (c *XMLConfigContainer) SaveConfigFile(filename string) (err error)
- func (c *XMLConfigContainer) Set(key, val string) error
- func (c *XMLConfigContainer) String(key string) string
- func (c *XMLConfigContainer) Strings(key string) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type XMLConfig ¶
type XMLConfig struct{}
XmlConfig 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 XMLConfigContainer ¶
A Config represents the xml configuration.
func (*XMLConfigContainer) Bool ¶
func (c *XMLConfigContainer) Bool(key string) (bool, error)
Bool returns the boolean value for a given key.
func (*XMLConfigContainer) DIY ¶
func (c *XMLConfigContainer) DIY(key string) (v interface{}, err error)
DIY returns the raw value by a given key.
func (*XMLConfigContainer) DefaultBool ¶ added in v1.4.0
func (c *XMLConfigContainer) DefaultBool(key string, defaultval bool) bool
DefaultBool return the bool value if has no error otherwise return the defaultval
func (*XMLConfigContainer) DefaultFloat ¶ added in v1.4.0
func (c *XMLConfigContainer) DefaultFloat(key string, defaultval float64) float64
DefaultFloat returns the float64 value for a given key. if err != nil return defaltval
func (*XMLConfigContainer) DefaultInt ¶ added in v1.4.0
func (c *XMLConfigContainer) DefaultInt(key string, defaultval int) int
DefaultInt returns the integer value for a given key. if err != nil return defaltval
func (*XMLConfigContainer) DefaultInt64 ¶ added in v1.4.0
func (c *XMLConfigContainer) DefaultInt64(key string, defaultval int64) int64
DefaultInt64 returns the int64 value for a given key. if err != nil return defaltval
func (*XMLConfigContainer) DefaultString ¶ added in v1.4.0
func (c *XMLConfigContainer) DefaultString(key string, defaultval string) string
DefaultString returns the string value for a given key. if err != nil return defaltval
func (*XMLConfigContainer) DefaultStrings ¶ added in v1.4.0
func (c *XMLConfigContainer) DefaultStrings(key string, defaultval []string) []string
DefaultStrings returns the []string value for a given key. if err != nil return defaltval
func (*XMLConfigContainer) Float ¶
func (c *XMLConfigContainer) Float(key string) (float64, error)
Float returns the float value for a given key.
func (*XMLConfigContainer) GetSection ¶ added in v1.4.0
func (c *XMLConfigContainer) GetSection(section string) (map[string]string, error)
GetSection returns map for the given section
func (*XMLConfigContainer) Int ¶
func (c *XMLConfigContainer) Int(key string) (int, error)
Int returns the integer value for a given key.
func (*XMLConfigContainer) Int64 ¶
func (c *XMLConfigContainer) Int64(key string) (int64, error)
Int64 returns the int64 value for a given key.
func (*XMLConfigContainer) SaveConfigFile ¶ added in v1.4.0
func (c *XMLConfigContainer) SaveConfigFile(filename string) (err error)
SaveConfigFile save the config into file
func (*XMLConfigContainer) Set ¶
func (c *XMLConfigContainer) Set(key, val string) error
WriteValue writes a new value for key.
func (*XMLConfigContainer) String ¶
func (c *XMLConfigContainer) String(key string) string
String returns the string value for a given key.
func (*XMLConfigContainer) Strings ¶
func (c *XMLConfigContainer) Strings(key string) []string
Strings returns the []string value for a given key.