Documentation
¶
Index ¶
- func SetFactory(dbFactory contracts.DBFactory)
- func WithTX(name string, tx contracts.DBTx) contracts.QueryBuilder
- type BaseModel
- type CreateException
- type DeleteException
- type Exception
- type InsertException
- type NotFoundException
- type SelectException
- type Table
- func (table *Table) Avg(column string, as ...string) int64
- func (table *Table) Chunk(size int, handler func(collection contracts.Collection, page int) error) (err error)
- func (table *Table) ChunkById(size int, handler func(collection contracts.Collection, page int) error) error
- func (table *Table) Count(columns ...string) int64
- func (table *Table) Create(fields contracts.Fields) interface{}
- func (table *Table) Delete() int64
- func (table *Table) Find(key interface{}) interface{}
- func (table *Table) First() interface{}
- func (table *Table) FirstOrCreate(values ...contracts.Fields) interface{}
- func (table *Table) FirstOrFail() interface{}
- func (table *Table) Get() contracts.Collection
- func (table *Table) Insert(values ...contracts.Fields) bool
- func (table *Table) InsertGetId(values ...contracts.Fields) int64
- func (table *Table) InsertOrIgnore(values ...contracts.Fields) int64
- func (table *Table) InsertOrReplace(values ...contracts.Fields) int64
- func (table *Table) Max(column string, as ...string) int64
- func (table *Table) Min(column string, as ...string) int64
- func (table *Table) SelectForUpdate() contracts.Collection
- func (table *Table) SetClass(class contracts.Class) *Table
- func (table *Table) SetConnection(connection interface{}) *Table
- func (table *Table) SetExecutor(executor contracts.SqlExecutor) contracts.QueryBuilder
- func (table *Table) SetPrimaryKey(name string) *Table
- func (table *Table) Sum(column string, as ...string) int64
- func (table *Table) Update(fields contracts.Fields) int64
- func (table *Table) UpdateOrCreate(attributes contracts.Fields, values ...contracts.Fields) interface{}
- func (table *Table) UpdateOrInsert(attributes contracts.Fields, values ...contracts.Fields) bool
- type UpdateException
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetFactory ¶ added in v0.1.15
Types ¶
type BaseModel ¶ added in v0.1.3
type BaseModel struct {
// contains filtered or unexported fields
}
func (BaseModel) GetConnection ¶ added in v0.1.3
func (BaseModel) GetPrimaryKey ¶ added in v0.1.3
func (BaseModel) SetPrimaryKey ¶ added in v0.1.3
type CreateException ¶
type CreateException = Exception
type DeleteException ¶
type DeleteException = Exception
type Exception ¶ added in v0.1.14
type Exception struct {
Sql string
Bindings []interface{}
Err error
// contains filtered or unexported fields
}
func (*Exception) GetPrevious ¶ added in v0.1.14
type InsertException ¶
type InsertException = Exception
type NotFoundException ¶
type NotFoundException = Exception
type SelectException ¶
type SelectException = Exception
type Table ¶
type Table struct {
contracts.QueryBuilder
// contains filtered or unexported fields
}
func WithConnection ¶
WithConnection 使用指定链接
func (*Table) FirstOrCreate ¶
func (*Table) FirstOrFail ¶
func (table *Table) FirstOrFail() interface{}
func (*Table) Get ¶
func (table *Table) Get() contracts.Collection
func (*Table) InsertOrReplace ¶
func (*Table) SelectForUpdate ¶ added in v0.1.5
func (table *Table) SelectForUpdate() contracts.Collection
func (*Table) SetConnection ¶
SetConnection 参数要么是 contracts.DBConnection 要么是 string
func (*Table) SetExecutor ¶
func (table *Table) SetExecutor(executor contracts.SqlExecutor) contracts.QueryBuilder
SetExecutor 参数必须是 contracts.DBTx 实例
func (*Table) SetPrimaryKey ¶
SetPrimaryKey 设置主键
func (*Table) UpdateOrCreate ¶
type UpdateException ¶
type UpdateException = Exception
Click to show internal directories.
Click to hide internal directories.