db

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDataSource

func AddDataSource(name string, dbPool *pool.DbPool)

AddDataSource Add DbPool as a data source

func Commit

func Commit(id uint64) error

Commit transaction

func GetConnection

func GetConnection(name string) (*pool.Connection, error)

GetConnection Obtaining a connection from a specified data source

func GetTx

func GetTx(id uint64, dataSourceName string) (*sql.Tx, error)

GetTx Get the corresponding transaction manager based on ID and data source name

func Rollback

func Rollback(id uint64) error

Rollback transactions

func SelectList

func SelectList(connection *sql.DB, sql string, params []interface{}) ([]map[string]string, error)

SelectList Query list based on sql and parameters

func Transaction

func Transaction() (uint64, error)

Transaction Open a transaction

func Update

func Update(connection *sql.DB, sql string, params []interface{}) (sql.Result, error)

Update Add, delete and change operations

func UpdateByTx

func UpdateByTx(tx *sql.Tx, sql string, params []interface{}) (sql.Result, error)

UpdateByTx Add, delete and change operations

Types

type TxData

type TxData struct {
	Tx   *sql.Tx
	Conn *pool.Connection
}

Jump to

Keyboard shortcuts

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