Documentation ¶
Index ¶
- func GetBools(key string, delim string) ([]bool, error)
- func GetFloats(key string, delim string) ([]float64, error)
- func GetInt64s(key string, delim string) ([]int64, error)
- func GetInts(key string, delim string) ([]int, error)
- func GetStrings(key string, delim string) ([]string, error)
- func GetStruct(ptr interface{}) error
- func MustBool(key string, defaultValue ...bool) bool
- func MustFloat(key string, defaultValue ...float64) float64
- func MustInt(key string, defaultValue ...int) int
- func MustInt32(key string, defaultValue ...int32) int32
- func MustInt64(key string, defaultValue ...int64) int64
- func MustString(key string, defaultValue ...string) string
- func MustTime(key string, format string, defaultValue ...time.Time) time.Time
- func ParseFile(file_path string, cfg *ConfigData) error
- func SplitAndTrim(str string, sep string) (string, string, bool)
- func SplitString(str string, sep string) (string, string, bool)
- type ConfigData
- func (this *ConfigData) GetBool(key string, defaultValue ...bool) ValidBool
- func (this ConfigData) GetBools(key string, delim string) ([]bool, error)
- func (this *ConfigData) GetFloat(key string, defaultValue ...float64) ValidFloat
- func (this ConfigData) GetFloats(key string, delim string) ([]float64, error)
- func (this *ConfigData) GetInt(key string, defaultValue ...int) ValidInt
- func (this *ConfigData) GetInt32(key string, defaultValue ...int32) ValidInt32
- func (this *ConfigData) GetInt64(key string, defaultValue ...int64) ValidInt64
- func (this ConfigData) GetInt64s(key string, delim string) ([]int64, error)
- func (this ConfigData) GetInts(key string, delim string) ([]int, error)
- func (this *ConfigData) GetString(key string, defaultValue ...string) ValidString
- func (this ConfigData) GetStrings(key string, delim string) ([]string, error)
- func (this *ConfigData) GetStruct(ptr interface{}) error
- func (this ConfigData) GetTime(key string, format string, defaultValue ...time.Time) ValidTime
- func (this *ConfigData) MustBool(key string, defaultValue ...bool) bool
- func (this *ConfigData) MustFloat(key string, defaultValue ...float64) float64
- func (this *ConfigData) MustInt(key string, defaultValue ...int) int
- func (this *ConfigData) MustInt32(key string, defaultValue ...int32) int32
- func (this *ConfigData) MustInt64(key string, defaultValue ...int64) int64
- func (this *ConfigData) MustString(key string, default_value ...string) string
- func (this *ConfigData) MustTime(key string, format string, defaultValue ...time.Time) time.Time
- func (this *ConfigData) ParseFile(file_path string) error
- func (this *ConfigData) SaveConfig(filename string) error
- func (this *ConfigData) Section(section ...string) ConfigSection
- func (this *ConfigData) SetData(section string, name string, value string)
- type ConfigItem
- type ConfigSection
- func (this ConfigSection) GetBool(key string, defaultValue ...bool) ValidBool
- func (this ConfigSection) GetBools(key string, delim string) ([]bool, error)
- func (this ConfigSection) GetFloat(key string, defaultValue ...float64) ValidFloat
- func (this ConfigSection) GetFloats(key string, delim string) ([]float64, error)
- func (this ConfigSection) GetInt(key string, defaultValue ...int) ValidInt
- func (this ConfigSection) GetInt32(key string, defaultValue ...int32) ValidInt32
- func (this ConfigSection) GetInt64(key string, defaultValue ...int64) ValidInt64
- func (this ConfigSection) GetInt64s(key string, delim string) ([]int64, error)
- func (this ConfigSection) GetInts(key string, delim string) ([]int, error)
- func (this ConfigSection) GetString(key string, defaultValue ...string) ValidString
- func (this ConfigSection) GetStrings(key string, delim string) ([]string, error)
- func (this ConfigSection) GetStruct(ptr interface{}) error
- func (this ConfigSection) GetTime(key string, format string, defaultValue ...time.Time) ValidTime
- func (this ConfigSection) MustBool(key string, defaultValue ...bool) bool
- func (this ConfigSection) MustFloat(key string, defaultValue ...float64) float64
- func (this ConfigSection) MustInt(key string, defaultValue ...int) int
- func (this ConfigSection) MustInt32(key string, defaultValue ...int32) int32
- func (this ConfigSection) MustInt64(key string, defaultValue ...int64) int64
- func (this ConfigSection) MustString(key string, defaultValue ...string) string
- func (this ConfigSection) MustTime(key string, format string, defaultValue ...time.Time) time.Time
- type TagInfo
- type ValidBool
- type ValidFloat
- type ValidInt
- type ValidInt32
- type ValidInt64
- type ValidString
- type ValidTime
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustString ¶
func ParseFile ¶
func ParseFile(file_path string, cfg *ConfigData) error
在 ini 文件中,每个键值对占用一行,中间使用=隔开。以#开头的内容为注释。 ini 文件是以分区(section)组织的。 分区以[name]开始,在下一个分区前结束。所有分区前的内容属于默认分区
Types ¶
type ConfigData ¶
type ConfigData struct {
// contains filtered or unexported fields
}
func InitConfigData ¶
func InitConfigData(file_name ...string) (*ConfigData, error)
func (*ConfigData) GetBool ¶
func (this *ConfigData) GetBool(key string, defaultValue ...bool) ValidBool
func (ConfigData) GetBools ¶
func (this ConfigData) GetBools(key string, delim string) ([]bool, error)
func (*ConfigData) GetFloat ¶
func (this *ConfigData) GetFloat(key string, defaultValue ...float64) ValidFloat
func (ConfigData) GetFloats ¶
func (this ConfigData) GetFloats(key string, delim string) ([]float64, error)
func (*ConfigData) GetInt ¶
func (this *ConfigData) GetInt(key string, defaultValue ...int) ValidInt
func (*ConfigData) GetInt32 ¶
func (this *ConfigData) GetInt32(key string, defaultValue ...int32) ValidInt32
func (*ConfigData) GetInt64 ¶
func (this *ConfigData) GetInt64(key string, defaultValue ...int64) ValidInt64
func (ConfigData) GetInt64s ¶
func (this ConfigData) GetInt64s(key string, delim string) ([]int64, error)
func (*ConfigData) GetString ¶
func (this *ConfigData) GetString(key string, defaultValue ...string) ValidString
func (ConfigData) GetStrings ¶
func (this ConfigData) GetStrings(key string, delim string) ([]string, error)
func (*ConfigData) GetStruct ¶
func (this *ConfigData) GetStruct(ptr interface{}) error
func (*ConfigData) MustBool ¶
func (this *ConfigData) MustBool(key string, defaultValue ...bool) bool
func (*ConfigData) MustFloat ¶
func (this *ConfigData) MustFloat(key string, defaultValue ...float64) float64
func (*ConfigData) MustInt32 ¶
func (this *ConfigData) MustInt32(key string, defaultValue ...int32) int32
func (*ConfigData) MustInt64 ¶
func (this *ConfigData) MustInt64(key string, defaultValue ...int64) int64
func (*ConfigData) MustString ¶
func (this *ConfigData) MustString(key string, default_value ...string) string
func (*ConfigData) ParseFile ¶
func (this *ConfigData) ParseFile(file_path string) error
func (*ConfigData) SaveConfig ¶
func (this *ConfigData) SaveConfig(filename string) error
func (*ConfigData) Section ¶
func (this *ConfigData) Section(section ...string) ConfigSection
type ConfigItem ¶
type ConfigItem struct {
// contains filtered or unexported fields
}
type ConfigSection ¶
func Section ¶
func Section(section ...string) ConfigSection
func (ConfigSection) GetBool ¶
func (this ConfigSection) GetBool(key string, defaultValue ...bool) ValidBool
func (ConfigSection) GetBools ¶
func (this ConfigSection) GetBools(key string, delim string) ([]bool, error)
func (ConfigSection) GetFloat ¶
func (this ConfigSection) GetFloat(key string, defaultValue ...float64) ValidFloat
func (ConfigSection) GetFloats ¶
func (this ConfigSection) GetFloats(key string, delim string) ([]float64, error)
func (ConfigSection) GetInt ¶
func (this ConfigSection) GetInt(key string, defaultValue ...int) ValidInt
func (ConfigSection) GetInt32 ¶
func (this ConfigSection) GetInt32(key string, defaultValue ...int32) ValidInt32
func (ConfigSection) GetInt64 ¶
func (this ConfigSection) GetInt64(key string, defaultValue ...int64) ValidInt64
func (ConfigSection) GetInt64s ¶
func (this ConfigSection) GetInt64s(key string, delim string) ([]int64, error)
func (ConfigSection) GetInts ¶
func (this ConfigSection) GetInts(key string, delim string) ([]int, error)
func (ConfigSection) GetString ¶
func (this ConfigSection) GetString(key string, defaultValue ...string) ValidString
func (ConfigSection) GetStrings ¶
func (this ConfigSection) GetStrings(key string, delim string) ([]string, error)
func (ConfigSection) GetStruct ¶
func (this ConfigSection) GetStruct(ptr interface{}) error
func (ConfigSection) MustBool ¶
func (this ConfigSection) MustBool(key string, defaultValue ...bool) bool
func (ConfigSection) MustFloat ¶
func (this ConfigSection) MustFloat(key string, defaultValue ...float64) float64
func (ConfigSection) MustInt ¶
func (this ConfigSection) MustInt(key string, defaultValue ...int) int
func (ConfigSection) MustInt32 ¶
func (this ConfigSection) MustInt32(key string, defaultValue ...int32) int32
func (ConfigSection) MustInt64 ¶
func (this ConfigSection) MustInt64(key string, defaultValue ...int64) int64
func (ConfigSection) MustString ¶
func (this ConfigSection) MustString(key string, defaultValue ...string) string
type ValidFloat ¶
func GetFloat ¶
func GetFloat(key string, defaultValue ...float64) ValidFloat
type ValidInt32 ¶
func GetInt32 ¶
func GetInt32(key string, defaultValue ...int32) ValidInt32
type ValidInt64 ¶
func GetInt64 ¶
func GetInt64(key string, defaultValue ...int64) ValidInt64
type ValidString ¶
func GetString ¶
func GetString(key string, defaultValue ...string) ValidString
Click to show internal directories.
Click to hide internal directories.