table

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2022 License: MIT Imports: 7 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseRows

func ParseRows(rows *sql.Rows) ([]contracts.Fields, error)

func WithTX

func WithTX(name string, tx contracts.DBTx) contracts.QueryBuilder

WithTX 使用TX

Types

type BaseModel added in v0.1.3

type BaseModel struct {
	// contains filtered or unexported fields
}

func NewModel added in v0.1.3

func NewModel(class contracts.Class, table string, connection ...string) BaseModel

func (BaseModel) GetClass added in v0.1.3

func (model BaseModel) GetClass() contracts.Class

func (BaseModel) GetConnection added in v0.1.3

func (model BaseModel) GetConnection() string

func (BaseModel) GetPrimaryKey added in v0.1.3

func (model BaseModel) GetPrimaryKey() string

func (BaseModel) GetTable added in v0.1.3

func (model BaseModel) GetTable() string

func (BaseModel) SetPrimaryKey added in v0.1.3

func (model BaseModel) SetPrimaryKey(key string)

type CreateException

type CreateException struct {
	contracts.Exception
}

type DeleteException

type DeleteException struct {
	contracts.Exception
}

type InsertException

type InsertException struct {
	contracts.Exception
}

type NotFoundException

type NotFoundException struct {
	contracts.Exception
}

type SelectException

type SelectException struct {
	contracts.Exception
}

type Table

type Table struct {
	contracts.QueryBuilder
	// contains filtered or unexported fields
}

func FromModel

func FromModel(model contracts.Model) *Table

func Model

func Model(class contracts.Class, table string, connection ...string) *Table

func Query

func Query(name string) *Table

Query 将使用默认 connection

func WithConnection

func WithConnection(name string, connection interface{}) *Table

WithConnection 使用指定链接

func (*Table) Avg

func (this *Table) Avg(column string, as ...string) int64

func (*Table) Chunk

func (this *Table) Chunk(size int, handler func(collection contracts.Collection, page int) error) (err error)

func (*Table) ChunkById

func (this *Table) ChunkById(size int, handler func(collection contracts.Collection, page int) error) error

func (*Table) Count

func (this *Table) Count(columns ...string) int64

func (*Table) Create

func (this *Table) Create(fields contracts.Fields) interface{}

func (*Table) Delete

func (this *Table) Delete() int64

func (*Table) Find

func (this *Table) Find(key interface{}) interface{}

func (*Table) First

func (this *Table) First() interface{}

func (*Table) FirstOrCreate

func (this *Table) FirstOrCreate(values ...contracts.Fields) interface{}

func (*Table) FirstOrFail

func (this *Table) FirstOrFail() interface{}

func (*Table) Get

func (this *Table) Get() contracts.Collection

func (*Table) Insert

func (this *Table) Insert(values ...contracts.Fields) bool

func (*Table) InsertGetId

func (this *Table) InsertGetId(values ...contracts.Fields) int64

func (*Table) InsertOrIgnore

func (this *Table) InsertOrIgnore(values ...contracts.Fields) int64

func (*Table) InsertOrReplace

func (this *Table) InsertOrReplace(values ...contracts.Fields) int64

func (*Table) Max

func (this *Table) Max(column string, as ...string) int64

func (*Table) Min

func (this *Table) Min(column string, as ...string) int64

func (*Table) SetClass

func (this *Table) SetClass(class contracts.Class) *Table

SetClass 设置类

func (*Table) SetConnection

func (this *Table) SetConnection(connection interface{}) *Table

SetConnection 参数要么是 contracts.DBConnection 要么是 string

func (*Table) SetExecutor

func (this *Table) SetExecutor(executor contracts.SqlExecutor) contracts.QueryBuilder

SetExecutor 参数必须是 contracts.DBTx 实例

func (*Table) SetPrimaryKey

func (this *Table) SetPrimaryKey(name string) *Table

SetPrimaryKey 设置主键

func (*Table) Sum

func (this *Table) Sum(column string, as ...string) int64

func (*Table) Update

func (this *Table) Update(fields contracts.Fields) int64

func (*Table) UpdateOrCreate

func (this *Table) UpdateOrCreate(attributes contracts.Fields, values ...contracts.Fields) interface{}

func (*Table) UpdateOrInsert

func (this *Table) UpdateOrInsert(attributes contracts.Fields, values ...contracts.Fields) bool

type UpdateException

type UpdateException struct {
	contracts.Exception
}

Jump to

Keyboard shortcuts

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