query

package
v0.0.0-...-60a21d4 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	Conn     *Connection
	Query    *dbal.Query
	Mode     string
	Database string
	Schema   string
	Grammar  dbal.Grammar
}

func NewBuilder

func NewBuilder(driver string, dsn string) *Builder

func UseBuilder

func UseBuilder(conn *Connection) *Builder

func (*Builder) Avg

func (builder *Builder) Avg(columns ...interface{}) (orm.N, error)

func (*Builder) Builder

func (builder *Builder) Builder() *Builder

func (*Builder) Chunk

func (builder *Builder) Chunk(size int, callback func(items []interface{}, page int) error, v ...interface{}) error

func (*Builder) ChunkByID

func (builder *Builder) ChunkByID()

func (*Builder) Clone

func (builder *Builder) Clone() Query

func (*Builder) Count

func (builder *Builder) Count(columns ...interface{}) (int64, error)

func (*Builder) CrossJoin

func (builder *Builder) CrossJoin(table string) Query

func (*Builder) CrossJoinSub

func (builder *Builder) CrossJoinSub(qb interface{}, alias string) Query

func (*Builder) DB

func (builder *Builder) DB(usewrite ...bool) *sqlx.DB

func (*Builder) DD

func (builder *Builder) DD()

func (*Builder) Decrement

func (builder *Builder) Decrement(column interface{}, amount interface{}, extra ...interface{}) (int64, error)

func (*Builder) Delete

func (builder *Builder) Delete() (int64, error)

func (*Builder) Distinct

func (builder *Builder) Distinct(args ...interface{}) Query

func (*Builder) DoesntExist

func (builder *Builder) DoesntExist() (bool, error)

func (*Builder) Dump

func (builder *Builder) Dump()

func (*Builder) Exists

func (builder *Builder) Exists() (bool, error)

func (*Builder) Find

func (builder *Builder) Find(id interface{}, args ...interface{}) (orm.R, error)

func (*Builder) First

func (builder *Builder) First(v ...interface{}) (orm.R, error)

func (*Builder) From

func (builder *Builder) From(from string) Query

func (*Builder) FromRaw

func (builder *Builder) FromRaw(sql string, bindings ...interface{}) Query

func (*Builder) FromSub

func (builder *Builder) FromSub(qb interface{}, as string) Query

func (*Builder) Get

func (builder *Builder) Get(v ...interface{}) ([]orm.R, error)

func (*Builder) GetBindings

func (builder *Builder) GetBindings() []interface{}

func (*Builder) GroupBy

func (builder *Builder) GroupBy(groups ...interface{}) Query

func (*Builder) GroupByRaw

func (builder *Builder) GroupByRaw(expression string, bindings ...interface{}) Query

func (*Builder) Having

func (builder *Builder) Having(column interface{}, args ...interface{}) Query

func (*Builder) HavingBetween

func (builder *Builder) HavingBetween(column interface{}, values interface{}, args ...interface{}) Query

func (*Builder) HavingRaw

func (builder *Builder) HavingRaw(sql string, bindings ...interface{}) Query

func (*Builder) InRandomOrder

func (builder *Builder) InRandomOrder()

func (*Builder) Increment

func (builder *Builder) Increment(column interface{}, amount interface{}, extra ...interface{}) (int64, error)

func (*Builder) Insert

func (builder *Builder) Insert(v interface{}, columns ...interface{}) error

func (*Builder) InsertGetID

func (builder *Builder) InsertGetID(v interface{}, args ...interface{}) (int64, error)

func (*Builder) InsertOrIgnore

func (builder *Builder) InsertOrIgnore(v interface{}, columns ...interface{}) (int64, error)

func (*Builder) InsertUsing

func (builder *Builder) InsertUsing(qb interface{}, columns ...interface{}) (int64, error)

func (*Builder) IsRead

func (builder *Builder) IsRead() bool

func (*Builder) IsWrite

func (builder *Builder) IsWrite() bool

func (*Builder) Join

func (builder *Builder) Join(table string, first interface{}, args ...interface{}) Query

func (*Builder) JoinRaw

func (builder *Builder) JoinRaw(sql string, bindings ...interface{}) Query

func (*Builder) JoinSub

func (builder *Builder) JoinSub(qb interface{}, alias string, first interface{}, args ...interface{}) Query

func (*Builder) JoinWhere

func (builder *Builder) JoinWhere()

func (*Builder) Latest

func (builder *Builder) Latest()

func (*Builder) LeftJoin

func (builder *Builder) LeftJoin(table string, first interface{}, args ...interface{}) Query

func (*Builder) LeftJoinSub

func (builder *Builder) LeftJoinSub(qb interface{}, alias string, first interface{}, args ...interface{}) Query

func (*Builder) LeftJoinWhere

func (builder *Builder) LeftJoinWhere()

func (*Builder) Limit

func (builder *Builder) Limit(value int) Query

func (*Builder) Lock

func (builder *Builder) Lock(value interface{}) Query

func (*Builder) LockForUpdate

func (builder *Builder) LockForUpdate() Query

func (*Builder) Max

func (builder *Builder) Max(columns ...interface{}) (orm.N, error)

func (*Builder) Min

func (builder *Builder) Min(columns ...interface{}) (orm.N, error)

func (*Builder) MustAvg

func (builder *Builder) MustAvg(columns ...interface{}) orm.N

func (*Builder) MustChunk

func (builder *Builder) MustChunk(size int, callback func(items []interface{}, page int) error, v ...interface{})

func (*Builder) MustChunkByID

func (builder *Builder) MustChunkByID()

func (*Builder) MustCount

func (builder *Builder) MustCount(columns ...interface{}) int64

func (*Builder) MustDecrement

func (builder *Builder) MustDecrement(column interface{}, amount interface{}, extra ...interface{}) int64

func (*Builder) MustDelete

func (builder *Builder) MustDelete() int64

func (*Builder) MustDoesntExist

func (builder *Builder) MustDoesntExist() bool

func (*Builder) MustExists

func (builder *Builder) MustExists() bool

func (*Builder) MustFind

func (builder *Builder) MustFind(id interface{}, args ...interface{}) orm.R

func (*Builder) MustFirst

func (builder *Builder) MustFirst(v ...interface{}) orm.R

func (*Builder) MustGet

func (builder *Builder) MustGet(v ...interface{}) []orm.R

func (*Builder) MustIncrement

func (builder *Builder) MustIncrement(column interface{}, amount interface{}, extra ...interface{}) int64

func (*Builder) MustInsert

func (builder *Builder) MustInsert(v interface{}, columns ...interface{})

func (*Builder) MustInsertGetID

func (builder *Builder) MustInsertGetID(v interface{}, args ...interface{}) int64

func (*Builder) MustInsertOrIgnore

func (builder *Builder) MustInsertOrIgnore(v interface{}, columns ...interface{}) int64

func (*Builder) MustInsertUsing

func (builder *Builder) MustInsertUsing(qb interface{}, columns ...interface{}) int64

func (*Builder) MustMax

func (builder *Builder) MustMax(columns ...interface{}) orm.N

func (*Builder) MustMin

func (builder *Builder) MustMin(columns ...interface{}) orm.N

func (*Builder) MustPaginate

func (builder *Builder) MustPaginate(pageSize int, page int, v ...interface{}) orm.P

func (*Builder) MustPluck

func (builder *Builder) MustPluck()

func (*Builder) MustSum

func (builder *Builder) MustSum(columns ...interface{}) orm.N

func (*Builder) MustTruncate

func (builder *Builder) MustTruncate()

func (*Builder) MustUpdate

func (builder *Builder) MustUpdate(v interface{}) int64

func (*Builder) MustUpdateOrInsert

func (builder *Builder) MustUpdateOrInsert(attributes interface{}, values ...interface{}) bool

func (*Builder) MustUpsert

func (builder *Builder) MustUpsert(values interface{}, uniqueBy interface{}, update interface{}, columns ...interface{}) int64

func (*Builder) MustValue

func (builder *Builder) MustValue(column string, v ...interface{}) interface{}

func (*Builder) New

func (builder *Builder) New() Query

func (*Builder) NewBuilder

func (builder *Builder) NewBuilder() *Builder

func (*Builder) Offset

func (builder *Builder) Offset(value int) Query

func (*Builder) Oldest

func (builder *Builder) Oldest()

func (*Builder) On

func (builder *Builder) On(first interface{}, args ...interface{}) Query

func (*Builder) OrHaving

func (builder *Builder) OrHaving(column interface{}, args ...interface{}) Query

func (*Builder) OrHavingBetween

func (builder *Builder) OrHavingBetween(column interface{}, values interface{}, args ...interface{}) Query

func (*Builder) OrHavingRaw

func (builder *Builder) OrHavingRaw(sql string, bindings ...interface{}) Query

func (*Builder) OrOn

func (builder *Builder) OrOn(first interface{}, args ...interface{}) Query

func (*Builder) OrWhere

func (builder *Builder) OrWhere(column interface{}, args ...interface{}) Query

func (*Builder) OrWhereBetween

func (builder *Builder) OrWhereBetween(column interface{}, values interface{}) Query

func (*Builder) OrWhereColumn

func (builder *Builder) OrWhereColumn(first interface{}, args ...interface{}) Query

func (*Builder) OrWhereDate

func (builder *Builder) OrWhereDate(column interface{}, args ...interface{}) Query

func (*Builder) OrWhereDay

func (builder *Builder) OrWhereDay(column interface{}, args ...interface{}) Query

func (*Builder) OrWhereExists

func (builder *Builder) OrWhereExists(closure func(qb Query)) Query

func (*Builder) OrWhereIn

func (builder *Builder) OrWhereIn(column interface{}, values interface{}) Query

func (*Builder) OrWhereJSONContains

func (builder *Builder) OrWhereJSONContains()

func (*Builder) OrWhereJSONDoesntContain

func (builder *Builder) OrWhereJSONDoesntContain()

func (*Builder) OrWhereJSONLength

func (builder *Builder) OrWhereJSONLength()

func (*Builder) OrWhereMonth

func (builder *Builder) OrWhereMonth(column interface{}, args ...interface{}) Query

func (*Builder) OrWhereNotBetween

func (builder *Builder) OrWhereNotBetween(column interface{}, values interface{}) Query

func (*Builder) OrWhereNotExists

func (builder *Builder) OrWhereNotExists(closure func(qb Query)) Query

func (*Builder) OrWhereNotIn

func (builder *Builder) OrWhereNotIn(column interface{}, values interface{}) Query

func (*Builder) OrWhereNotNull

func (builder *Builder) OrWhereNotNull(column interface{}) Query

func (*Builder) OrWhereNull

func (builder *Builder) OrWhereNull(column interface{}) Query

func (*Builder) OrWhereRaw

func (builder *Builder) OrWhereRaw(sql string, bindings ...interface{}) Query

func (*Builder) OrWhereTime

func (builder *Builder) OrWhereTime(column interface{}, args ...interface{}) Query

func (*Builder) OrWhereYear

func (builder *Builder) OrWhereYear(column interface{}, args ...interface{}) Query

func (*Builder) OrderBy

func (builder *Builder) OrderBy(column interface{}, args ...string) Query

func (*Builder) OrderByDesc

func (builder *Builder) OrderByDesc(column interface{}) Query

func (*Builder) OrderByRaw

func (builder *Builder) OrderByRaw(sql string, bindings ...interface{}) Query

func (*Builder) Paginate

func (builder *Builder) Paginate(pageSize int, page int, v ...interface{}) (orm.P, error)

func (*Builder) Pluck

func (builder *Builder) Pluck()

func (*Builder) Reorder

func (builder *Builder) Reorder(args ...interface{}) Query

func (*Builder) Reset

func (builder *Builder) Reset() Query

func (*Builder) RightJoin

func (builder *Builder) RightJoin(table string, first interface{}, args ...interface{}) Query

func (*Builder) RightJoinSub

func (builder *Builder) RightJoinSub(qb interface{}, alias string, first interface{}, args ...interface{}) Query

func (*Builder) RightJoinWhere

func (builder *Builder) RightJoinWhere()

func (*Builder) SQL

func (builder *Builder) SQL(stmt string, bindings ...interface{}) Query

func (*Builder) Select

func (builder *Builder) Select(columns ...interface{}) Query

func (*Builder) SelectAppend

func (builder *Builder) SelectAppend(columns ...interface{}) Query

func (*Builder) SelectRaw

func (builder *Builder) SelectRaw(expression string, bindings ...interface{}) Query

func (*Builder) SelectSub

func (builder *Builder) SelectSub(qb interface{}, as string) Query

func (*Builder) SharedLock

func (builder *Builder) SharedLock() Query

func (*Builder) Skip

func (builder *Builder) Skip(value int) Query

func (*Builder) Sum

func (builder *Builder) Sum(columns ...interface{}) (orm.N, error)

func (*Builder) Table

func (builder *Builder) Table(name string) Query

func (*Builder) Take

func (builder *Builder) Take(value int) Query

func (*Builder) ToSQL

func (builder *Builder) ToSQL() string

func (*Builder) Truncate

func (builder *Builder) Truncate() error

func (*Builder) Union

func (builder *Builder) Union(query interface{}, all ...bool) Query

func (*Builder) UnionAll

func (builder *Builder) UnionAll(query interface{}) Query

func (*Builder) Unless

func (builder *Builder) Unless(value bool, callback func(qb Query, value bool), defaults ...func(qb Query, value bool)) Query

func (*Builder) Update

func (builder *Builder) Update(v interface{}) (int64, error)

func (*Builder) UpdateOrInsert

func (builder *Builder) UpdateOrInsert(attributes interface{}, values ...interface{}) (bool, error)

func (*Builder) Upsert

func (builder *Builder) Upsert(v interface{}, uniqueBy interface{}, update interface{}, columns ...interface{}) (int64, error)

func (*Builder) UseRead

func (builder *Builder) UseRead() Query

func (*Builder) UseWrite

func (builder *Builder) UseWrite() Query

func (*Builder) Value

func (builder *Builder) Value(column string, v ...interface{}) (interface{}, error)

func (*Builder) When

func (builder *Builder) When(value bool, callback func(qb Query, value bool), defaults ...func(qb Query, value bool)) Query

func (*Builder) Where

func (builder *Builder) Where(column interface{}, args ...interface{}) Query

func (*Builder) WhereBetween

func (builder *Builder) WhereBetween(column interface{}, values interface{}) Query

func (*Builder) WhereColumn

func (builder *Builder) WhereColumn(first interface{}, args ...interface{}) Query

func (*Builder) WhereDate

func (builder *Builder) WhereDate(column interface{}, args ...interface{}) Query

func (*Builder) WhereDay

func (builder *Builder) WhereDay(column interface{}, args ...interface{}) Query

func (*Builder) WhereExists

func (builder *Builder) WhereExists(closure func(qb Query)) Query

func (*Builder) WhereIn

func (builder *Builder) WhereIn(column interface{}, values interface{}) Query

func (*Builder) WhereJSONContains

func (builder *Builder) WhereJSONContains()

func (*Builder) WhereJSONDoesntContain

func (builder *Builder) WhereJSONDoesntContain()

func (*Builder) WhereJSONLength

func (builder *Builder) WhereJSONLength()

func (*Builder) WhereMonth

func (builder *Builder) WhereMonth(column interface{}, args ...interface{}) Query

func (*Builder) WhereNotBetween

func (builder *Builder) WhereNotBetween(column interface{}, values interface{}) Query

func (*Builder) WhereNotExists

func (builder *Builder) WhereNotExists(closure func(qb Query)) Query

func (*Builder) WhereNotIn

func (builder *Builder) WhereNotIn(column interface{}, values interface{}) Query

func (*Builder) WhereNotNull

func (builder *Builder) WhereNotNull(column interface{}, args ...interface{}) Query

func (*Builder) WhereNull

func (builder *Builder) WhereNull(column interface{}, args ...interface{}) Query

func (*Builder) WhereRaw

func (builder *Builder) WhereRaw(sql string, bindings ...interface{}) Query

func (*Builder) WhereTime

func (builder *Builder) WhereTime(column interface{}, args ...interface{}) Query

func (*Builder) WhereYear

func (builder *Builder) WhereYear(column interface{}, args ...interface{}) Query

type Connection

type Connection struct {
	Write       *sqlx.DB
	WriteConfig *dbal.Config
	Read        *sqlx.DB
	ReadConfig  *dbal.Config
	Option      *dbal.Option
}

type Query

type Query interface {
	New() Query
	Clone() Query
	Reset() Query
	Builder() *Builder
	Table(name string) Query
	Get(v ...interface{}) ([]orm.R, error)
	MustGet(v ...interface{}) []orm.R
	First(v ...interface{}) (orm.R, error)
	MustFirst(v ...interface{}) orm.R
	Find(id interface{}, args ...interface{}) (orm.R, error)
	MustFind(id interface{}, args ...interface{}) orm.R
	Value(column string, v ...interface{}) (interface{}, error)
	MustValue(column string, v ...interface{}) interface{}
	Exists() (bool, error)
	MustExists() bool
	DoesntExist() (bool, error)
	MustDoesntExist() bool
	ToSQL() string
	GetBindings() []interface{}
	Paginate(perpage int, page int, v ...interface{}) (orm.P, error)
	MustPaginate(perpage int, page int, v ...interface{}) orm.P
	Chunk(size int, callback func(items []interface{}, page int) error, v ...interface{}) error
	MustChunk(size int, callback func(items []interface{}, page int) error, v ...interface{})
	DB(usewrite ...bool) *sqlx.DB
	IsRead() bool
	UseRead() Query
	UseWrite() Query
	IsWrite() bool
	Count(columns ...interface{}) (int64, error)
	MustCount(columns ...interface{}) int64
	Min(columns ...interface{}) (orm.N, error)
	MustMin(columns ...interface{}) orm.N
	Max(columns ...interface{}) (orm.N, error)
	MustMax(columns ...interface{}) orm.N
	Sum(columns ...interface{}) (orm.N, error)
	MustSum(columns ...interface{}) orm.N
	Avg(columns ...interface{}) (orm.N, error)
	MustAvg(columns ...interface{}) orm.N
	SQL(stmt string, bindings ...interface{}) Query
	Select(columns ...interface{}) Query
	SelectAppend(columns ...interface{}) Query
	SelectRaw(expression string, bindings ...interface{}) Query
	SelectSub(qb interface{}, alias string) Query
	Distinct(args ...interface{}) Query
	From(name string) Query
	FromRaw(sql string, bindings ...interface{}) Query
	FromSub(qb interface{}, alias string) Query
	Union(query interface{}, all ...bool) Query
	UnionAll(query interface{}) Query
	Join(table string, first interface{}, args ...interface{}) Query
	JoinRaw(sql string, bindings ...interface{}) Query
	JoinSub(qb interface{}, alias string, first interface{}, args ...interface{}) Query
	LeftJoin(table string, first interface{}, args ...interface{}) Query
	LeftJoinSub(qb interface{}, alias string, first interface{}, args ...interface{}) Query
	RightJoin(table string, first interface{}, args ...interface{}) Query
	RightJoinSub(qb interface{}, alias string, first interface{}, args ...interface{}) Query
	CrossJoin(table string) Query
	CrossJoinSub(qb interface{}, alias string) Query
	On(first interface{}, args ...interface{}) Query
	OrOn(first interface{}, args ...interface{}) Query
	Where(column interface{}, args ...interface{}) Query
	OrWhere(column interface{}, args ...interface{}) Query
	WhereColumn(first interface{}, args ...interface{}) Query
	OrWhereColumn(first interface{}, args ...interface{}) Query
	WhereNull(column interface{}, args ...interface{}) Query
	OrWhereNull(column interface{}) Query
	WhereNotNull(column interface{}, args ...interface{}) Query
	OrWhereNotNull(column interface{}) Query
	WhereRaw(sql string, bindings ...interface{}) Query
	OrWhereRaw(sql string, bindings ...interface{}) Query
	WhereBetween(column interface{}, values interface{}) Query
	OrWhereBetween(column interface{}, values interface{}) Query
	WhereNotBetween(column interface{}, values interface{}) Query
	OrWhereNotBetween(column interface{}, values interface{}) Query
	WhereIn(column interface{}, values interface{}) Query
	OrWhereIn(column interface{}, values interface{}) Query
	WhereNotIn(column interface{}, values interface{}) Query
	OrWhereNotIn(column interface{}, values interface{}) Query
	WhereExists(closure func(qb Query)) Query
	OrWhereExists(closure func(qb Query)) Query
	WhereNotExists(closure func(qb Query)) Query
	OrWhereNotExists(closure func(qb Query)) Query
	WhereDate(column interface{}, args ...interface{}) Query
	OrWhereDate(column interface{}, args ...interface{}) Query
	WhereTime(column interface{}, args ...interface{}) Query
	OrWhereTime(column interface{}, args ...interface{}) Query
	WhereYear(column interface{}, args ...interface{}) Query
	OrWhereYear(column interface{}, args ...interface{}) Query
	WhereMonth(column interface{}, args ...interface{}) Query
	OrWhereMonth(column interface{}, args ...interface{}) Query
	WhereDay(column interface{}, args ...interface{}) Query
	OrWhereDay(column interface{}, args ...interface{}) Query
	When(value bool, callback func(qb Query, value bool), defaults ...func(qb Query, value bool)) Query
	Unless(value bool, callback func(qb Query, value bool), defaults ...func(qb Query, value bool)) Query
	GroupBy(groups ...interface{}) Query
	GroupByRaw(expression string, bindings ...interface{}) Query
	Having(column interface{}, args ...interface{}) Query
	OrHaving(column interface{}, args ...interface{}) Query
	HavingBetween(column interface{}, values interface{}, args ...interface{}) Query
	OrHavingBetween(column interface{}, values interface{}, args ...interface{}) Query
	HavingRaw(sql string, bindings ...interface{}) Query
	OrHavingRaw(sql string, bindings ...interface{}) Query
	OrderBy(column interface{}, args ...string) Query
	OrderByDesc(column interface{}) Query
	OrderByRaw(sql string, bindings ...interface{}) Query
	Skip(value int) Query
	Offset(value int) Query
	Take(value int) Query
	Limit(value int) Query
	SharedLock() Query
	LockForUpdate() Query
	Insert(v interface{}, columns ...interface{}) error
	MustInsert(v interface{}, columns ...interface{})
	InsertOrIgnore(v interface{}, columns ...interface{}) (int64, error)
	MustInsertOrIgnore(v interface{}, columns ...interface{}) int64
	InsertGetID(v interface{}, args ...interface{}) (int64, error)
	MustInsertGetID(v interface{}, args ...interface{}) int64
	InsertUsing(qb interface{}, columns ...interface{}) (int64, error)
	MustInsertUsing(qb interface{}, columns ...interface{}) int64
	Upsert(values interface{}, uniqueBy interface{}, update interface{}, columns ...interface{}) (int64, error)
	MustUpsert(values interface{}, uniqueBy interface{}, update interface{}, columns ...interface{}) int64
	UpdateOrInsert(attributes interface{}, values ...interface{}) (bool, error)
	MustUpdateOrInsert(attributes interface{}, values ...interface{}) bool
	Update(v interface{}) (int64, error)
	MustUpdate(v interface{}) int64
	Increment(column interface{}, amount interface{}, extra ...interface{}) (int64, error)
	MustIncrement(column interface{}, amount interface{}, extra ...interface{}) int64
	Decrement(column interface{}, amount interface{}, extra ...interface{}) (int64, error)
	MustDecrement(column interface{}, amount interface{}, extra ...interface{}) int64
	Delete() (int64, error)
	MustDelete() int64
	Truncate() error
	MustTruncate()
	DD()
	Dump()
}

func New

func New(driver string, dsn string) Query

func Use

func Use(conn *Connection) Query

Jump to

Keyboard shortcuts

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