dao

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DAOProxy

type DAOProxy struct {
	DBWriter, DBReader *lib.MysqlClient
	// contains filtered or unexported fields
}

func (*DAOProxy) AddRecord

func (this *DAOProxy) AddRecord(vals interface{}) int

AddRecord、SetRecord、ResetRecord 支持传入map[string]interface{} 和 struct 两种类型参数 AddRecord {{{

func (*DAOProxy) Bind

func (this *DAOProxy) Bind(objPtr interface{}) *DAOProxy

必须为指针 单条记录指向 struct , 多条记录指向[]struct 或 []*struct 使用: NewDAOUser().bind([]struct).GetRecords(...

func (*DAOProxy) DelRecord

func (this *DAOProxy) DelRecord(id interface{}) int

DelRecord {{{

func (*DAOProxy) DelRecordBy

func (this *DAOProxy) DelRecordBy(where string, params ...interface{}) int

DelRecordBy {{{

func (*DAOProxy) DelRecords

func (this *DAOProxy) DelRecords(where string, params ...interface{}) int

DelRecords {{{ Is Dangerous!

func (*DAOProxy) Execute

func (this *DAOProxy) Execute(sql string, params ...interface{}) int

func (*DAOProxy) Exists

func (this *DAOProxy) Exists(id interface{}) bool

Exists {{{

func (*DAOProxy) ExistsBy

func (this *DAOProxy) ExistsBy(where string, params ...interface{}) bool

ExistsBy {{{

func (*DAOProxy) Fillin

func (this *DAOProxy) Fillin(obj interface{}, data map[string]interface{})

map to struct

func (*DAOProxy) FuncParam

func (this *DAOProxy) FuncParam(param interface{}) string

以无引号方式代入值,谨慎使用!!!

func (*DAOProxy) GetCount

func (this *DAOProxy) GetCount(where string, params ...interface{}) int

GetCount {{{

func (*DAOProxy) GetCountField

func (this *DAOProxy) GetCountField() string

func (*DAOProxy) GetDBReader

func (this *DAOProxy) GetDBReader() *lib.MysqlClient

func (*DAOProxy) GetFields

func (this *DAOProxy) GetFields() string

func (*DAOProxy) GetList

func (this *DAOProxy) GetList(where string, start, num int, order string, params ...interface{}) (int, []map[string]interface{})

大数据下会有性能问题,请谨慎使用 由于底层每次查询都是从连接池中获取连接,所以开启只读事务,以保证FOUND_ROWS()的两条sql使用同一连接 GetList{{

func (*DAOProxy) GetOne

func (this *DAOProxy) GetOne(field, where string, params ...interface{}) interface{}

func (*DAOProxy) GetPrimary

func (this *DAOProxy) GetPrimary() string

func (*DAOProxy) GetRecord

func (this *DAOProxy) GetRecord(id interface{}) map[string]interface{}

GetRecord {{{

func (*DAOProxy) GetRecordBy

func (this *DAOProxy) GetRecordBy(where string, params ...interface{}) map[string]interface{}

GetRecordBy {{{

func (*DAOProxy) GetRecords

func (this *DAOProxy) GetRecords(where string, start, num int, order string, params ...interface{}) []map[string]interface{}

GetRecords {{{

func (*DAOProxy) GetTable

func (this *DAOProxy) GetTable() string

func (*DAOProxy) Init

func (this *DAOProxy) Init(conf ...string)

func (*DAOProxy) InitTx

func (this *DAOProxy) InitTx(tx *lib.MysqlClient)

func (*DAOProxy) Query

func (this *DAOProxy) Query(sql string, params ...interface{}) []map[string]interface{}

复杂查询

func (*DAOProxy) ResetRecord

func (this *DAOProxy) ResetRecord(vals interface{}) int

ResetRecord {{{

func (*DAOProxy) SetCountField

func (this *DAOProxy) SetCountField(field string) *DAOProxy

func (*DAOProxy) SetDefaultFields

func (this *DAOProxy) SetDefaultFields(fields string) *DAOProxy

func (*DAOProxy) SetFields

func (this *DAOProxy) SetFields(fields string) *DAOProxy

可在读方法前使用,且仅对本次查询起作用,如: NewDAOUser().SetFields("uid").GetRecord(uid)

func (*DAOProxy) SetPrimary

func (this *DAOProxy) SetPrimary(field string)

func (*DAOProxy) SetRecord

func (this *DAOProxy) SetRecord(vals interface{}, id interface{}) int

SetRecord {{{

func (*DAOProxy) SetRecordBy

func (this *DAOProxy) SetRecordBy(vals interface{}, where string, params ...interface{}) int

SetRecordBy {{{

func (*DAOProxy) SetTable

func (this *DAOProxy) SetTable(table string)

func (*DAOProxy) UseIndex

func (this *DAOProxy) UseIndex(idx string) *DAOProxy

func (*DAOProxy) UseMaster

func (this *DAOProxy) UseMaster(flag ...bool) *DAOProxy

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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