db

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2022 License: Apache-2.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 HoTimeDB

type HoTimeDB struct {
	*sql.DB
	ContextBase
	DBName string
	*cache.HoTimeCache
	Type        string
	Prefix      string
	LastQuery   string
	LastData    []interface{}
	ConnectFunc func(err ...*Error) (*sql.DB, *sql.DB)
	LastErr     *Error

	*sql.Tx //事务对象
	SlaveDB *sql.DB
	// contains filtered or unexported fields
}

func (*HoTimeDB) Action

func (that *HoTimeDB) Action(action func(db HoTimeDB) bool) bool

Action 事务,如果action返回true则执行成功;false则回滚

func (*HoTimeDB) Count

func (that *HoTimeDB) Count(table string, qu ...interface{}) int

Count 计数

func (*HoTimeDB) Delete

func (that *HoTimeDB) Delete(table string, data map[string]interface{}) int64

func (*HoTimeDB) Exec

func (that *HoTimeDB) Exec(query string, args ...interface{}) (sql.Result, *Error)

func (*HoTimeDB) Get

func (that *HoTimeDB) Get(table string, qu ...interface{}) Map

func (*HoTimeDB) GetPrefix

func (that *HoTimeDB) GetPrefix() string

func (*HoTimeDB) GetType

func (that *HoTimeDB) GetType() string

GetType 设置数据库配置连接

func (*HoTimeDB) InitDb

func (that *HoTimeDB) InitDb(err ...*Error) *Error

func (*HoTimeDB) Insert

func (that *HoTimeDB) Insert(table string, data map[string]interface{}) int64

Insert 插入新数据

func (*HoTimeDB) Page

func (that *HoTimeDB) Page(page, pageRow int) *HoTimeDB

func (*HoTimeDB) PageSelect

func (that *HoTimeDB) PageSelect(table string, qu ...interface{}) []Map

func (*HoTimeDB) Query

func (that *HoTimeDB) Query(query string, args ...interface{}) []Map

func (*HoTimeDB) Row

func (that *HoTimeDB) Row(resl *sql.Rows) []Map

Row 数据库数据解析

func (*HoTimeDB) Select

func (that *HoTimeDB) Select(table string, qu ...interface{}) []Map

func (*HoTimeDB) SetConnect

func (that *HoTimeDB) SetConnect(connect func(err ...*Error) (master, slave *sql.DB), err ...*Error)

SetConnect 设置数据库配置连接

func (*HoTimeDB) Update

func (that *HoTimeDB) Update(table string, data Map, where Map) int64

Update 更新数据

Jump to

Keyboard shortcuts

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