mysql

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB = Mysql{
	SqlDBmap: map[string]*sql.DB{},
}

Functions

This section is empty.

Types

type Mysql

type Mysql struct {
	SqlDBmap map[string]*sql.DB
	Once     sync.Once
}

func GetMysqlDB

func GetMysqlDB() *Mysql

func (*Mysql) BeginTransactions

func (db *Mysql) BeginTransactions() *SqlTxStruct

func (*Mysql) BeginTransactionsByLevel

func (db *Mysql) BeginTransactionsByLevel() *SqlTxStruct

func (*Mysql) Exec

func (db *Mysql) Exec(query string, args ...interface{}) sql.Result

func (*Mysql) InitDB

func (db *Mysql) InitDB(cfglist map[string]config.Database)

func (*Mysql) Query

func (db *Mysql) Query(query string, args ...interface{}) ([]map[string]interface{}, *sql.Rows)

func (*Mysql) QueryWithConnection

func (db *Mysql) QueryWithConnection(con string, query string, args ...interface{}) ([]map[string]interface{}, *sql.Rows)

func (*Mysql) WithTransaction

func (db *Mysql) WithTransaction(fn TxFn) (err error, res map[string]interface{})

type SqlTxStruct

type SqlTxStruct struct {
	Tx *sql.Tx
}

func (*SqlTxStruct) Exec

func (SqlTx *SqlTxStruct) Exec(query string, args ...interface{}) (sql.Result, error)

func (*SqlTxStruct) Query

func (SqlTx *SqlTxStruct) Query(query string, args ...interface{}) ([]map[string]interface{}, error)

type TxFn

type TxFn func(*SqlTxStruct) (error, map[string]interface{})

Jump to

Keyboard shortcuts

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