mysql

package
v0.0.0-...-dd82a4e Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2021 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) BeginTransactionsWithLevel

func (db *Mysql) BeginTransactionsWithLevel(level sql.IsolationLevel) *SqlTxStruct

func (*Mysql) BeginTransactionsWithReadCommitted

func (db *Mysql) BeginTransactionsWithReadCommitted() *SqlTxStruct

func (*Mysql) BeginTransactionsWithReadUncommitted

func (db *Mysql) BeginTransactionsWithReadUncommitted() *SqlTxStruct

func (*Mysql) BeginTransactionsWithRepeatableRead

func (db *Mysql) BeginTransactionsWithRepeatableRead() *SqlTxStruct

func (*Mysql) Exec

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

func (*Mysql) GetName

func (db *Mysql) GetName() string

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{})

func (*Mysql) WithTransactionByLevel

func (db *Mysql) WithTransactionByLevel(level sql.IsolationLevel, 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