mysql

package module
v0.0.0-...-53e2c75 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2019 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetPoolConns

func SetPoolConns(active, idle int) (err error)

SetPoolConns : dynamic set pool conns

Types

type Dao

type Dao struct {
	*sql.DB
	*sqlbuilder.SQLBuilder

	DaoStruct     string
	DaoStructType reflect.Type
}

Dao : the data access object struct

func NewDao

func NewDao() *Dao

NewDao : create a new empty Dao

func (*Dao) Delete

func (dao *Dao) Delete(s string) (r sql.Result, err error)

func (*Dao) Get

func (dao *Dao) Get() (rows *sql.Rows, err error)

func (*Dao) GetConfig

func (dao *Dao) GetConfig() *mysql.Config

GetConfig : return mysql.Config

func (*Dao) GetRow

func (dao *Dao) GetRow() (row *sql.Row, err error)

func (*Dao) Insert

func (dao *Dao) Insert(s string) (r sql.Result, err error)

func (*Dao) OpenDB

func (dao *Dao) OpenDB() *Dao

OpenDB : connect to db

func (*Dao) OpenDBWithPoolConns

func (dao *Dao) OpenDBWithPoolConns(active, idle int) *Dao

OpenDBWithPoolConns : connect to db and set pool conns

func (*Dao) Scan

func (dao *Dao) Scan(rows *sql.Rows) (t []interface{}, err error)

func (*Dao) ScanRow

func (dao *Dao) ScanRow(row *sql.Row) (t interface{}, err error)

func (*Dao) ScanRowType

func (dao *Dao) ScanRowType(row *sql.Row, tb interface{}) (t interface{}, err error)

func (*Dao) ScanType

func (dao *Dao) ScanType(rows *sql.Rows, tb interface{}) (t []interface{}, err error)

func (*Dao) SetConfig

func (dao *Dao) SetConfig(user, pw, addr, db string) *Dao

SetConfig : set config by user, pw, addr, db

func (*Dao) SetDefaultModel

func (dao *Dao) SetDefaultModel(tb interface{}, deftultTbName string) (err error)

SetDefaultModel : set the struct for this dao default

func (*Dao) SetOriginConfig

func (dao *Dao) SetOriginConfig(c *mysql.Config) *Dao

SetOriginConfig : set config by mysql.Config

func (*Dao) Update

func (dao *Dao) Update(s string) (r sql.Result, err error)

type Tx

type Tx struct {
	*sql.Tx
}

Tx : the transaction of Dao

func (*Tx) GetLock

func (t *Tx) GetLock(key string, secs int) (cnt int, err error)

GetLock : get a session lock via Dao transaction

func (*Tx) ReleaseLock

func (t *Tx) ReleaseLock(key string) (cnt int, err error)

ReleaseLock : release a session lock via Dao transaction

Jump to

Keyboard shortcuts

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