dbconfig

package
v0.0.0-...-2c5cb3b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

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 接口

func (*MySQLConfig) Parse

func (self *MySQLConfig) Parse(filename string) (config.Configer, error)

func (*MySQLConfig) ParseData

func (self *MySQLConfig) ParseData(data []byte) (config.Configer, error)

type MySQLConfiger

type MySQLConfiger struct {
	// contains filtered or unexported fields
}

MySQLConfiger 是 MySQL 数据读取的实例,只有在读取数据时使用

func (*MySQLConfiger) Bool

func (self *MySQLConfiger) Bool(key string) (bool, error)

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) Float

func (self *MySQLConfiger) Float(key string) (float64, error)

func (*MySQLConfiger) GetSection

func (self *MySQLConfiger) GetSection(section string) (map[string]string, error)

func (*MySQLConfiger) Int

func (self *MySQLConfiger) Int(key string) (int, error)

func (*MySQLConfiger) Int64

func (self *MySQLConfiger) Int64(key string) (int64, 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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL