mysql

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MysqlConn

type MysqlConn struct {
	Host   string
	Port   string
	User   string
	Pwd    string
	DbName string
	// contains filtered or unexported fields
}

func NewMysqlConn

func NewMysqlConn(host, port, user, pwd, dbName string, ext ...string) (*MysqlConn, error)

If you do not want to preselect a database, leave dbName empty thus, caller need select database before operation on table

func (*MysqlConn) Close

func (conn *MysqlConn) Close() error

func (*MysqlConn) Exec

func (conn *MysqlConn) Exec(query string, args ...interface{}) (int64, int64, error)

func (*MysqlConn) NewTx

func (conn *MysqlConn) NewTx() (*MysqlTx, error)

func (*MysqlConn) PrepareExec

func (conn *MysqlConn) PrepareExec(query string, args ...interface{}) (int64, int64, error)

func (*MysqlConn) Query

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

type MysqlTx

type MysqlTx struct {
	Tx *sql.Tx
}

func (*MysqlTx) Commit

func (tx *MysqlTx) Commit() error

func (*MysqlTx) Exec

func (tx *MysqlTx) Exec(query string, args ...interface{}) (num int64, lastId int64, err error)

func (*MysqlTx) PrepareExec

func (tx *MysqlTx) PrepareExec(query string, args ...interface{}) (int64, int64, error)

func (*MysqlTx) Query

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

func (*MysqlTx) RollBack

func (tx *MysqlTx) RollBack()

Jump to

Keyboard shortcuts

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