mysql

package
v0.0.0-...-cbc8b8c Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SQLConnPool

type SQLConnPool struct {
	DriverName     string
	DataSourceName string
	MaxOpenConns   int
	MaxIdleConns   int
	SQLDB          *sql.DB
}

SQLConnPool is DB pool struct

func InitMySQLPool

func InitMySQLPool(host, database, user, password, charset string, maxOpenConns, maxIdleConns int) *SQLConnPool

InitMySQLPool func init DB pool

func (*SQLConnPool) Begin

func (p *SQLConnPool) Begin() (*SQLConnTransaction, error)

Begin transaction

func (*SQLConnPool) Close

func (p *SQLConnPool) Close() error

Close pool

func (*SQLConnPool) Delete

func (p *SQLConnPool) Delete(deleteStr string, args ...interface{}) (int64, error)

Delete via pool

func (*SQLConnPool) Insert

func (p *SQLConnPool) Insert(insertStr string, args ...interface{}) (int64, error)

Insert via pool

func (*SQLConnPool) Query

func (p *SQLConnPool) Query(queryStr string, args ...interface{}) ([]map[string]interface{}, error)

Query via pool

func (*SQLConnPool) Update

func (p *SQLConnPool) Update(updateStr string, args ...interface{}) (int64, error)

Update via pool

type SQLConnTransaction

type SQLConnTransaction struct {
	SQLTX *sql.Tx
}

SQLConnTransaction is for transaction connection

func (*SQLConnTransaction) Commit

func (t *SQLConnTransaction) Commit() error

Commit transaction

func (*SQLConnTransaction) Delete

func (t *SQLConnTransaction) Delete(deleteStr string, args ...interface{}) (int64, error)

Delete via transaction

func (*SQLConnTransaction) Insert

func (t *SQLConnTransaction) Insert(insertStr string, args ...interface{}) (int64, error)

Insert via transaction

func (*SQLConnTransaction) Query

func (t *SQLConnTransaction) Query(queryStr string, args ...interface{}) ([]map[string]interface{}, error)

Query via transaction

func (*SQLConnTransaction) Rollback

func (t *SQLConnTransaction) Rollback() error

Rollback transaction

func (*SQLConnTransaction) Update

func (t *SQLConnTransaction) Update(updateStr string, args ...interface{}) (int64, error)

Update via transaction

Jump to

Keyboard shortcuts

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