Documentation
¶
Index ¶
- Variables
- type ConfigTable
- type MySQLConfig
- type MySQLConfiger
- func (self *MySQLConfiger) Bool(key string) (bool, error)
- func (self *MySQLConfiger) DIY(key string) (interface{}, error)
- func (self *MySQLConfiger) DefaultBool(key string, defaultVal bool) bool
- func (self *MySQLConfiger) DefaultFloat(key string, defaultVal float64) float64
- func (self *MySQLConfiger) DefaultInt(key string, defaultVal int) int
- func (self *MySQLConfiger) DefaultInt64(key string, defaultVal int64) int64
- func (self *MySQLConfiger) DefaultString(key, defaultVal string) string
- func (self *MySQLConfiger) DefaultStrings(key string, defaultVal []string) []string
- func (self *MySQLConfiger) Float(key string) (float64, error)
- func (self *MySQLConfiger) GetSection(section string) (map[string]string, error)
- func (self *MySQLConfiger) Int(key string) (int, error)
- func (self *MySQLConfiger) Int64(key string) (int64, error)
- func (self *MySQLConfiger) SaveConfigFile(filename string) error
- func (self *MySQLConfiger) Set(key, val string) error
- func (self *MySQLConfiger) SetCacheTimeout(timeout time.Duration)
- func (self *MySQLConfiger) SetUseDB(db string)
- func (self *MySQLConfiger) String(key string) string
- func (self *MySQLConfiger) Strings(key string) []string
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Err ErrNotSupport error = errors.New("not support for dbconfig") )
Functions ¶
This section is empty.
Types ¶
type ConfigTable ¶
type ConfigTable struct { Id int Key string `orm:"unique"` Value string `orm:"type(text)"` Created time.Time `orm:"auto_now_add;type(datetime)"` Updated time.Time `orm:"auto_now;type(datetime)"` Comment string // 配置说明 }
ConfigTable 是配置的 DB 表结构,主要的配置都存储在 DB 中
type MySQLConfig ¶
type MySQLConfig struct{}
MySQLConfig 是一个以 MySQL 作为存储后端动态配置组件,完全继承了 beego Config 接口
type MySQLConfiger ¶
type MySQLConfiger struct {
// contains filtered or unexported fields
}
MySQLConfiger 是 MySQL 数据读取的实例,只有在读取数据时使用
func (*MySQLConfiger) DIY ¶
func (self *MySQLConfiger) DIY(key string) (interface{}, error)
func (*MySQLConfiger) DefaultBool ¶
func (self *MySQLConfiger) DefaultBool(key string, defaultVal bool) bool
func (*MySQLConfiger) DefaultFloat ¶
func (self *MySQLConfiger) DefaultFloat(key string, defaultVal float64) float64
func (*MySQLConfiger) DefaultInt ¶
func (self *MySQLConfiger) DefaultInt(key string, defaultVal int) int
func (*MySQLConfiger) DefaultInt64 ¶
func (self *MySQLConfiger) DefaultInt64(key string, defaultVal int64) int64
func (*MySQLConfiger) DefaultString ¶
func (self *MySQLConfiger) DefaultString(key, defaultVal string) string
func (*MySQLConfiger) DefaultStrings ¶
func (self *MySQLConfiger) DefaultStrings(key string, defaultVal []string) []string
func (*MySQLConfiger) GetSection ¶
func (self *MySQLConfiger) GetSection(section string) (map[string]string, error)
func (*MySQLConfiger) SaveConfigFile ¶
func (self *MySQLConfiger) SaveConfigFile(filename string) error
func (*MySQLConfiger) Set ¶
func (self *MySQLConfiger) Set(key, val string) error
func (*MySQLConfiger) SetCacheTimeout ¶
func (self *MySQLConfiger) SetCacheTimeout(timeout time.Duration)
SetCacheTimeout 设置多次读取同一个 key 的缓存时间
func (*MySQLConfiger) SetUseDB ¶
func (self *MySQLConfiger) SetUseDB(db string)
SetUseDB 设置要使用的 DB,该 DB 必须已经在主程序中初始化
func (*MySQLConfiger) String ¶
func (self *MySQLConfiger) String(key string) string
func (*MySQLConfiger) Strings ¶
func (self *MySQLConfiger) Strings(key string) []string
Click to show internal directories.
Click to hide internal directories.