Documentation ¶
Index ¶
- func SetField(obj interface{}, name string, value interface{}) error
- type ConfigEngine
- func (c *ConfigEngine) Get(name string) interface{}
- func (c *ConfigEngine) GetBool(name string, defaultValue bool) bool
- func (c *ConfigEngine) GetData() map[string]interface{}
- func (c *ConfigEngine) GetFloat64(name string, defaultValue float64) float64
- func (c *ConfigEngine) GetInt(name string, defaultValue int) int
- func (c *ConfigEngine) GetInt64(name string, defaultValue int64) int64
- func (c *ConfigEngine) GetString(name string, defaultValue string) string
- func (c *ConfigEngine) GetStruct(name string, s interface{}) interface{}
- func (c *ConfigEngine) LoadConf(path string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConfigEngine ¶
type ConfigEngine struct {
// contains filtered or unexported fields
}
配置文件结构体
func NewConf ¶
func NewConf() *ConfigEngine
func (*ConfigEngine) GetBool ¶
func (c *ConfigEngine) GetBool(name string, defaultValue bool) bool
从配置文件中获取bool类型的值
func (*ConfigEngine) GetData ¶
func (c *ConfigEngine) GetData() map[string]interface{}
func (*ConfigEngine) GetFloat64 ¶
func (c *ConfigEngine) GetFloat64(name string, defaultValue float64) float64
从配置文件中获取Float64类型的值
func (*ConfigEngine) GetInt ¶
func (c *ConfigEngine) GetInt(name string, defaultValue int) int
从配置文件中获取int类型的值,defaultValue是默认值的
func (*ConfigEngine) GetInt64 ¶
func (c *ConfigEngine) GetInt64(name string, defaultValue int64) int64
func (*ConfigEngine) GetString ¶
func (c *ConfigEngine) GetString(name string, defaultValue string) string
从配置文件中获取string类型的值
func (*ConfigEngine) GetStruct ¶
func (c *ConfigEngine) GetStruct(name string, s interface{}) interface{}
从配置文件中获取Struct类型的值 这里的struct是你自己定义的根据配置文件 s必须是传递结构体的指针 name是yaml定义的结构体名称
func (*ConfigEngine) LoadConf ¶
func (c *ConfigEngine) LoadConf(path string) error
加载yaml,yml内容到c.Data
Click to show internal directories.
Click to hide internal directories.