dbs

package
v1.1.38 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2022 License: GPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const MaxConcatLen = "18446744073709551615"
View Source
const MaxIdleConns = 80
View Source
const MaxIdleTime = 30 * time.Minute
View Source
const MaxLifeTime = 30 * time.Minute
View Source
const MaxOpenConns = 256

Variables

This section is empty.

Functions

This section is empty.

Types

type DBMysql

type DBMysql struct {
	Edb *sql.DB
	Etx *sql.Tx
}

func NewDBMysql

func NewDBMysql(c v1config.DBConfig) (*DBMysql, error)

func (*DBMysql) BeginTrans

func (d *DBMysql) BeginTrans() (IDBMysql, error)

func (*DBMysql) CommitTrans

func (d *DBMysql) CommitTrans() error

func (*DBMysql) DB

func (d *DBMysql) DB() *sql.DB

func (*DBMysql) ExecuteCreate

func (d *DBMysql) ExecuteCreate(tableName string, fields map[string]interface{}) (int64, error)

func (*DBMysql) ExecuteQuery

func (d *DBMysql) ExecuteQuery(tableName string, fields map[string]interface{}, whereArr []string, whereArgs []interface{}, orderBy []string) (bool, error)

func (*DBMysql) ExecuteSearch

func (d *DBMysql) ExecuteSearch(tableName string, fields []string, whereArr []string, whereArgs []interface{}, orderBy []string, pageNum, pageSize int64, rowsHandler SearchRowsHandler) (int64, int64, error)

func (*DBMysql) ExecuteUpdate

func (d *DBMysql) ExecuteUpdate(tableName string, fields map[string]interface{}, whereArr []string, whereArgs []interface{}) (int64, error)

func (*DBMysql) RollbackTrans

func (d *DBMysql) RollbackTrans() error

func (*DBMysql) TX

func (d *DBMysql) TX() *sql.Tx

type IDBMysql

type IDBMysql interface {
	DB() *sql.DB
	TX() *sql.Tx

	ExecuteSearch(tableName string, fields []string, whereArr []string, whereArgs []interface{}, orderBy []string, pageNum, pageSize int64, rowsHandler SearchRowsHandler) (int64, int64, error)
	ExecuteQuery(tableName string, fields map[string]interface{}, whereArr []string, whereArgs []interface{}, orderBy []string) (bool, error)
	ExecuteCreate(tableName string, fields map[string]interface{}) (int64, error)
	ExecuteUpdate(tableName string, fields map[string]interface{}, whereArr []string, whereArgs []interface{}) (int64, error)

	BeginTrans() (IDBMysql, error)
	CommitTrans() error
	RollbackTrans() error
}

type SearchRowsHandler added in v1.1.23

type SearchRowsHandler func(*sql.Rows) error

Jump to

Keyboard shortcuts

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