Documentation ¶
Overview ¶
Package config ...
Package config ...
Package config ...
Package config ...
Package config ...
Package config ...
Index ¶
Constants ¶
View Source
const ( // ConfFormatTypeIni ini ConfFormatTypeIni confFormatType = iota // ConfFormatTypeToml toml ConfFormatTypeToml // ConfFormatTypeEtcd etcd ConfFormatTypeEtcd )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Configer ¶
type Configer interface { // load config content Load() error // Return when config changed LastModify() (time.Time, error) GetAllSections() map[string]Sectioner GetSection(sec string) (Sectioner, error) GetIntSetting(sec, key string) (val int64, err error) GetBoolSetting(sec, key string) (val bool, err error) GetFloatSetting(sec, key string) (val float64, err error) GetSetting(sec, key string) (val string, err error) }
Configer ...
func NewConfigWithFormatType ¶
NewConfigWithFormatType new configer according to conf-type
type Sectioner ¶
type Sectioner interface { GetInt(key string) (val int64, err error) GetBool(key string) (val bool, err error) GetFloat(key string) (val float64, err error) GetString(key string) (val string, err error) // Return defaultVal when key missed GetIntMust(key string, defaultVal int64) int64 GetBoolMust(key string, defaultVal bool) bool GetFloatMust(key string, defaultVal float64) float64 GetStringMust(key string, defaultVal string) string }
Sectioner contains key-value of each module
Click to show internal directories.
Click to hide internal directories.