sqlite

package
v0.0.0-...-0747d37 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2018 License: GPL-3.0 Imports: 10 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
	SqlDB          *sql.DB // 连接池
}
var (
	DB *SqlConnPool
)

func (*SqlConnPool) Begin

func (p *SqlConnPool) Begin() (*SqlConnTransaction, error)

// 开启一个事务

func (*SqlConnPool) Close

func (p *SqlConnPool) Close() error

func (*SqlConnPool) Delete

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

func (*SqlConnPool) Insert

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

func (*SqlConnPool) InsertMap

func (p *SqlConnPool) InsertMap(table string, m map[string]interface{}) (int64, error)

func (*SqlConnPool) Query

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

func (*SqlConnPool) QueryPage

func (p *SqlConnPool) QueryPage(page *utils.PageTable, args ...interface{}) (*utils.PageData, error)

func (*SqlConnPool) Update

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

type SqlConnTransaction

type SqlConnTransaction struct {
	SqlTx *sql.Tx // 单个事务连接
}

func (*SqlConnTransaction) Commit

func (t *SqlConnTransaction) Commit() error

func (*SqlConnTransaction) Delete

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

func (*SqlConnTransaction) Insert

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

func (*SqlConnTransaction) Query

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

func (*SqlConnTransaction) Rollback

func (t *SqlConnTransaction) Rollback() error

封装的单个事务连接的方法

func (*SqlConnTransaction) Update

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

Jump to

Keyboard shortcuts

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