database

package
v0.0.0-...-a60b5f4 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SqlDB *sql.DB
)

Functions

func Exec

func Exec(query string, args ...interface{}) (sql.Result, int64)

func Query

func Query(query string, args ...interface{}) []map[string]interface{}

func QueryWithConnection

func QueryWithConnection(con string, query string, args ...interface{}) []map[string]interface{}

func SetColVarType

func SetColVarType(colVar *[]interface{}, i int, typeName string)

func SetResultValue

func SetResultValue(result *map[string]interface{}, index string, colVar interface{}, typeName string)

func WithTransaction

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

func WithTransactionByLevel

func WithTransactionByLevel(level sql.IsolationLevel, fn TxFn) (err error, res map[string]interface{})

Types

type SqlTxStruct

type SqlTxStruct struct {
	Tx *sql.Tx
}

func BeginTransactions

func BeginTransactions() *SqlTxStruct

func BeginTransactionsWithLevel

func BeginTransactionsWithLevel(level sql.IsolationLevel) *SqlTxStruct

func BeginTransactionsWithReadCommitted

func BeginTransactionsWithReadCommitted() *SqlTxStruct

func BeginTransactionsWithReadUncommitted

func BeginTransactionsWithReadUncommitted() *SqlTxStruct

func BeginTransactionsWithRepeatableRead

func BeginTransactionsWithRepeatableRead() *SqlTxStruct

func (*SqlTxStruct) Exec

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

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