Documentation ¶
Index ¶
- Constants
- func Bool(section, key string) (bool, error)
- func DEFAULTSECTION() string
- func DeleteKey(section, key string) (bool, error)
- func DeleteSection(section string) (bool, error)
- func Float64(section, key string) (float64, error)
- func GetKeyComments(section, key string) (comments string)
- func GetKeyList(section string) []string
- func GetSection(section string) (map[string]string, error)
- func GetSectionComments(section string) (comments string)
- func GetSectionList() []string
- func GetValue(section, key string) (string, error)
- func Int(section, key string) (int, error)
- func Int64(section, key string) (int64, error)
- func MustBool(section, key string, defaultVal ...bool) bool
- func MustFloat64(section, key string, defaultVal ...float64) float64
- func MustInt(section, key string, defaultVal ...int) int
- func MustInt64(section, key string, defaultVal ...int64) int64
- func MustValue(section, key string, defaultVal ...string) string
- func MustValueArray(section, key, delim string) []string
- func MustValueRange(section, key, defaultVal string, candidates []string) string
- func MustValueSet(section, key string, defaultVal ...string) (string, bool, error)
- func SetKeyComments(section, key, comments string) (bool, error)
- func SetSectionComments(section, comments string) (bool, error)
- func SetValue(section, key, value string) (bool, error)
Constants ¶
const (
Config_Path = "./conf/app.conf" //默认的配置文件地址
)
Variables ¶
This section is empty.
Functions ¶
func DeleteSection ¶
DeleteSection deletes the entire section by given name. It returns true if the section was deleted, and false if the section didn't exist.
func GetKeyComments ¶
GetKeyComments returns the comments of key in the given section. It returns an empty string(0 length) if the comments do not exist.
func GetKeyList ¶
GetKeyList returns the list of all keys in give section in the same order in the file. It returns nil if given section does not exist.
func GetSection ¶
GetSection returns key-value pairs in given section. It section does not exist, returns nil and error.
func GetSectionComments ¶
GetSectionComments returns the comments in the given section. It returns an empty string(0 length) if the comments do not exist.
func GetSectionList ¶
func GetSectionList() []string
GetSectionList returns the list of all sections in the same order in the file.
func GetValue ¶
GetValue returns the value of key available in the given section. If the value needs to be unfolded (see e.g. %(google)s example in the GoConfig_test.go), then String does this unfolding automatically, up to _DEPTH_VALUES number of iterations. It returns an error and empty string value if the section does not exist, or key does not exist in DEFAULT and current sections.
func MustFloat64 ¶
MustFloat64 always returns value without error, it returns 0.0 if error occurs.
func MustValue ¶
MustValue always returns value without error. It returns empty string if error occurs, or the default value if given.
func MustValueArray ¶
MustValueArray always returns value array without error, it returns empty array if error occurs, split by delimiter otherwise.
func MustValueRange ¶
MustValueRange always returns value without error, it returns default value if error occurs or doesn't fit into range.
func MustValueSet ¶
MustValue always returns value without error, It returns empty string if error occurs, or the default value if given, and a bool value indicates whether default value is returned.
func SetKeyComments ¶
SetKeyComments adds new section-key comments to the configuration. If comments are empty(0 length), it will remove its section-key comments! It returns true if the comments were inserted or removed, or returns false if the comments were overwritten. If the section does not exist in advance, it is created.
func SetSectionComments ¶
SetSectionComments adds new section comments to the configuration. If comments are empty(0 length), it will remove its section comments! It returns true if the comments were inserted or removed, or returns false if the comments were overwritten.
Types ¶
This section is empty.