database

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMysql

func GetMysql(name string) (db *gorm.DB, put func(), err error)

GetMysql 获取一个mysql db连接

func GetRedis

func GetRedis(name string) (db redis.Conn, put func(), err error)

GetRedis 获取一个mysql db连接

func PullChanDB

func PullChanDB()

PullChanDB 持续监听将chan中的连接异步放回连接池

func PutConn

func PutConn(put func())

PutConn 将连接放回连接池方法

Types

type DataBase

type DataBase interface {
	RegisterAll()
	Register(string)
	// contains filtered or unexported methods
}

func NewMysql

func NewMysql() DataBase

NewMysql 初始化mysql连接

func NewRedis

func NewRedis() DataBase

NewRedis 初始化 redis 连接

type MysqlDB

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

func (*MysqlDB) Register

func (my *MysqlDB) Register(name string)

NewMysql 注册一个mysql配置

func (*MysqlDB) RegisterAll

func (my *MysqlDB) RegisterAll()

注册所有已配置的mysql

type RedisDB

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

func (*RedisDB) Register

func (re *RedisDB) Register(name string)

RegisterRedis 注册一个redis配置

func (*RedisDB) RegisterAll

func (re *RedisDB) RegisterAll()

注册所有已配置的 redis

Jump to

Keyboard shortcuts

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