Documentation ¶ Index ¶ Variables func InitRedis(cfg config.Configuration) type MySqlPool func GetInstance() *MySqlPool func (pool *MySqlPool) CloseDB() *gorm.DB func (pool *MySqlPool) GetDB() *gorm.DB func (pool *MySqlPool) InitPool(cfg config.Configuration) bool Constants ¶ This section is empty. Variables ¶ View Source var RedisClient *redis.Client Functions ¶ func InitRedis ¶ added in v1.0.9 func InitRedis(cfg config.Configuration) 初始化redis连接 Types ¶ type MySqlPool ¶ type MySqlPool struct{} func GetInstance ¶ func GetInstance() *MySqlPool 单例模式 func (*MySqlPool) CloseDB ¶ added in v1.0.9 func (pool *MySqlPool) CloseDB() *gorm.DB 关闭连接 func (*MySqlPool) GetDB ¶ func (pool *MySqlPool) GetDB() *gorm.DB 对外获取数据库连接对象db func (*MySqlPool) InitPool ¶ func (pool *MySqlPool) InitPool(cfg config.Configuration) bool 初始化数据库连接 Source Files ¶ View all Source files mysql.go redis.go Click to show internal directories. Click to hide internal directories.