Documentation ¶
Overview ¶
Package conf implements parse the ksf config. Usage: After initialization, use obj.GetXXX("/ksf/db<ip>") to get the corresponding data structure.
Index ¶
- Constants
- type Conf
- func (c *Conf) GetBoolWithDef(path string, defVal bool) bool
- func (c *Conf) GetDomain(path string) []string
- func (c *Conf) GetDomainKey(path string) []string
- func (c *Conf) GetDomainLine(path string) []string
- func (c *Conf) GetFloatWithDef(path string, defVal float64) float64
- func (c *Conf) GetInt(path string) int
- func (c *Conf) GetInt32WithDef(path string, defVal int32) int32
- func (c *Conf) GetIntWithDef(path string, defVal int) int
- func (c *Conf) GetMap(path string) map[string]string
- func (c *Conf) GetString(path string) string
- func (c *Conf) GetStringWithDef(path string, defVal string) string
- func (c *Conf) InitFromBytes(content []byte) error
- func (c *Conf) InitFromFile(fileName string) error
- func (c *Conf) InitFromString(content string) error
- func (c *Conf) ToString() string
Constants ¶
const ( // Node shows an element is a node Node = iota // Leaf shows an element is a leaf Leaf )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conf ¶
type Conf struct {
// contains filtered or unexported fields
}
Conf struct for parse xml-like ksf config file.
func NewConf ¶
NewConf returns a new Conf with the fileName
func (*Conf) GetBoolWithDef ¶
GetBoolWithDef get bool value
func (*Conf) GetDomain ¶
GetDomain returns the domain for pointed path
func (*Conf) GetDomainKey ¶
GetDomainKey returns the domain for pointed path
func (*Conf) GetDomainLine ¶
GetDomainLine returns the domain for pointed path
func (*Conf) GetFloatWithDef ¶
GetFloatWithDef get float value
func (*Conf) GetInt ¶
GetInt returns the value as an integer for pointed path
func (*Conf) GetInt32WithDef ¶
GetInt32WithDef get int32 value
func (*Conf) GetIntWithDef ¶
GetIntWithDef returns the value as an integer for pointed path, or a default value when error happens
func (*Conf) GetMap ¶
GetMap returns the key-value as a map for pointed path
func (*Conf) GetString ¶
GetString returns the value for pointed path
func (*Conf) GetStringWithDef ¶
GetStringWithDef returns the value for pointed path, or a default value when error happens
func (*Conf) InitFromBytes ¶
InitFromBytes returns error when init config from bytes
func (*Conf) InitFromFile ¶
InitFromFile returns error when init config from a file
func (*Conf) InitFromString ¶
InitFromString returns error when init config from a string