Documentation
¶
Index ¶
- Constants
- func FromSub(callback contracts.QueryProvider, as string) contracts.QueryBuilder
- func JoinStringerArray(arr []fmt.Stringer, sep string) (result string)
- func JoinSubStringerArray(arr []fmt.Stringer, sep string) (result string)
- type Builder
- func (this *Builder) AddSelect(fields ...string) contracts.QueryBuilder
- func (this *Builder) AddSelectSub(provider contracts.QueryProvider, as string) contracts.QueryBuilder
- func (this *Builder) Avg(column string, as ...string) int64
- func (this *Builder) Bind(builder contracts.QueryBuilder) contracts.QueryBuilder
- func (this *Builder) Count(columns ...string) int64
- func (this *Builder) Create(fields contracts.Fields) interface{}
- func (this *Builder) CreateSql(value contracts.Fields, insertType2 ...contracts.InsertType) (sql string, bindings []interface{})
- func (this *Builder) Delete() int64
- func (this *Builder) DeleteSql() (sql string, bindings []interface{})
- func (this *Builder) Distinct() contracts.QueryBuilder
- func (this *Builder) Find(key interface{}) interface{}
- func (this *Builder) First() interface{}
- func (this *Builder) FirstOr(provider contracts.InstanceProvider) interface{}
- func (this *Builder) FirstOrCreate(values ...contracts.Fields) interface{}
- func (this *Builder) FirstOrFail() interface{}
- func (this *Builder) FirstWhere(column string, args ...interface{}) interface{}
- func (this *Builder) From(table string, as ...string) contracts.QueryBuilder
- func (this *Builder) FromMany(tables ...string) contracts.QueryBuilder
- func (this *Builder) FromSub(provider contracts.QueryProvider, as string) contracts.QueryBuilder
- func (this *Builder) FullJoin(table string, first, condition, second string) contracts.QueryBuilder
- func (this *Builder) FullOutJoin(table string, first, condition, second string) contracts.QueryBuilder
- func (this *Builder) Get() contracts.Collection
- func (this *Builder) GetBindings() (results []interface{})
- func (this *Builder) GroupBy(columns ...string) contracts.QueryBuilder
- func (this *Builder) Having(field string, args ...interface{}) contracts.QueryBuilder
- func (this *Builder) InRandomOrder(orderFunc ...contracts.OrderType) contracts.QueryBuilder
- func (this *Builder) Insert(values ...contracts.Fields) bool
- func (this *Builder) InsertGetId(values ...contracts.Fields) int64
- func (this *Builder) InsertIgnoreSql(values []contracts.Fields) (sql string, bindings []interface{})
- func (this *Builder) InsertOrIgnore(values ...contracts.Fields) int64
- func (this *Builder) InsertOrReplace(values ...contracts.Fields) int64
- func (this *Builder) InsertReplaceSql(values []contracts.Fields) (sql string, bindings []interface{})
- func (this *Builder) InsertSql(values []contracts.Fields, insertType2 ...contracts.InsertType) (sql string, bindings []interface{})
- func (this *Builder) Join(table string, first, condition, second string, joins ...contracts.JoinType) contracts.QueryBuilder
- func (this *Builder) JoinSub(provider contracts.QueryProvider, as, first, condition, second string, ...) contracts.QueryBuilder
- func (this *Builder) LeftJoin(table string, first, condition, second string) contracts.QueryBuilder
- func (this *Builder) Limit(num int64) contracts.QueryBuilder
- func (this *Builder) Max(column string, as ...string) int64
- func (this *Builder) Min(column string, as ...string) int64
- func (this *Builder) Offset(offset int64) contracts.QueryBuilder
- func (this *Builder) OrHaving(field string, args ...interface{}) contracts.QueryBuilder
- func (this *Builder) OrWhere(field string, args ...interface{}) contracts.QueryBuilder
- func (this *Builder) OrWhereBetween(field string, args interface{}) contracts.QueryBuilder
- func (this *Builder) OrWhereExists(provider contracts.QueryProvider) contracts.QueryBuilder
- func (this *Builder) OrWhereFunc(callback contracts.QueryFunc) contracts.QueryBuilder
- func (this *Builder) OrWhereIn(field string, args interface{}) contracts.QueryBuilder
- func (this *Builder) OrWhereIsNull(field string) contracts.QueryBuilder
- func (this *Builder) OrWhereNotBetween(field string, args interface{}) contracts.QueryBuilder
- func (this *Builder) OrWhereNotExists(provider contracts.QueryProvider) contracts.QueryBuilder
- func (this *Builder) OrWhereNotIn(field string, args interface{}) contracts.QueryBuilder
- func (this *Builder) OrWhereNotNull(field string) contracts.QueryBuilder
- func (this *Builder) OrderBy(field string, columnOrderType ...contracts.OrderType) contracts.QueryBuilder
- func (this *Builder) OrderByDesc(field string) contracts.QueryBuilder
- func (this *Builder) Paginate(perPage int64, current ...int64) (contracts.Collection, int64)
- func (this *Builder) RightJoin(table string, first, condition, second string) contracts.QueryBuilder
- func (this *Builder) Select(fields ...string) contracts.QueryBuilder
- func (this *Builder) SelectForUpdate() contracts.Collection
- func (this *Builder) SelectForUpdateSql() (string, []interface{})
- func (this *Builder) SelectSql() (string, []interface{})
- func (this *Builder) SelectSub(provider contracts.QueryProvider, as string) contracts.QueryBuilder
- func (this *Builder) SetExecutor(executor contracts.SqlExecutor) contracts.QueryBuilder
- func (this *Builder) SimplePaginate(perPage int64, current ...int64) contracts.Collection
- func (this *Builder) Skip(offset int64) contracts.QueryBuilder
- func (this *Builder) Sum(column string, as ...string) int64
- func (this *Builder) Take(num int64) contracts.QueryBuilder
- func (this *Builder) ToSql() string
- func (this *Builder) Union(builder contracts.QueryBuilder, unionType ...contracts.UnionJoinType) contracts.QueryBuilder
- func (this *Builder) UnionAll(builder contracts.QueryBuilder) contracts.QueryBuilder
- func (this *Builder) UnionAllByProvider(builder contracts.QueryProvider) contracts.QueryBuilder
- func (this *Builder) UnionByProvider(builder contracts.QueryProvider, unionType ...contracts.UnionJoinType) contracts.QueryBuilder
- func (this *Builder) Update(fields contracts.Fields) int64
- func (this *Builder) UpdateOrCreate(attributes contracts.Fields, values ...contracts.Fields) interface{}
- func (this *Builder) UpdateOrInsert(attributes contracts.Fields, values ...contracts.Fields) bool
- func (this *Builder) UpdateSql(value contracts.Fields) (sql string, bindings []interface{})
- func (this *Builder) When(condition bool, callback contracts.QueryCallback, ...) contracts.QueryBuilder
- func (this *Builder) Where(field string, args ...interface{}) contracts.QueryBuilder
- func (this *Builder) WhereBetween(field string, args interface{}, whereType ...contracts.WhereJoinType) contracts.QueryBuilder
- func (this *Builder) WhereExists(provider contracts.QueryProvider, where ...contracts.WhereJoinType) contracts.QueryBuilder
- func (this *Builder) WhereFields(fields contracts.Fields) contracts.QueryBuilder
- func (this *Builder) WhereFunc(callback contracts.QueryFunc, whereType ...contracts.WhereJoinType) contracts.QueryBuilder
- func (this *Builder) WhereIn(field string, args interface{}, joinType ...contracts.WhereJoinType) contracts.QueryBuilder
- func (this *Builder) WhereIsNull(field string, whereType ...contracts.WhereJoinType) contracts.QueryBuilder
- func (this *Builder) WhereNotBetween(field string, args interface{}, whereType ...contracts.WhereJoinType) contracts.QueryBuilder
- func (this *Builder) WhereNotExists(provider contracts.QueryProvider, where ...contracts.WhereJoinType) contracts.QueryBuilder
- func (this *Builder) WhereNotIn(field string, args interface{}, joinType ...contracts.WhereJoinType) contracts.QueryBuilder
- func (this *Builder) WhereNotNull(field string, whereType ...contracts.WhereJoinType) contracts.QueryBuilder
- func (this *Builder) WithAvg(field string, as ...string) contracts.QueryBuilder
- func (this *Builder) WithCount(fields ...string) contracts.QueryBuilder
- func (this *Builder) WithMax(field string, as ...string) contracts.QueryBuilder
- func (this *Builder) WithMin(field string, as ...string) contracts.QueryBuilder
- func (this *Builder) WithPagination(perPage int64, current ...int64) contracts.QueryBuilder
- func (this *Builder) WithSum(field string, as ...string) contracts.QueryBuilder
- type Expression
- type GroupBy
- type Join
- type Joins
- type OrderBy
- type OrderByFields
- type ParamException
- type Unions
- type Where
- type Wheres
Constants ¶
View Source
const RandOrder contracts.OrderType = "RAND()"
View Source
const RandomOrder contracts.OrderType = "RANDOM()"
Variables ¶
This section is empty.
Functions ¶
func FromSub ¶
func FromSub(callback contracts.QueryProvider, as string) contracts.QueryBuilder
Types ¶
type Builder ¶
type Builder struct {
contracts.QueryBuilder
// contains filtered or unexported fields
}
func (*Builder) AddSelectSub ¶
func (this *Builder) AddSelectSub(provider contracts.QueryProvider, as string) contracts.QueryBuilder
func (*Builder) Bind ¶ added in v0.1.5
func (this *Builder) Bind(builder contracts.QueryBuilder) contracts.QueryBuilder
func (*Builder) Distinct ¶
func (this *Builder) Distinct() contracts.QueryBuilder
func (*Builder) FirstOr ¶ added in v0.1.2
func (this *Builder) FirstOr(provider contracts.InstanceProvider) interface{}
func (*Builder) FirstOrCreate ¶ added in v0.1.2
func (*Builder) FirstOrFail ¶ added in v0.1.2
func (this *Builder) FirstOrFail() interface{}
func (*Builder) FirstWhere ¶ added in v0.1.2
func (*Builder) FromSub ¶
func (this *Builder) FromSub(provider contracts.QueryProvider, as string) contracts.QueryBuilder
func (*Builder) FullJoin ¶
func (this *Builder) FullJoin(table string, first, condition, second string) contracts.QueryBuilder
func (*Builder) FullOutJoin ¶
func (this *Builder) FullOutJoin(table string, first, condition, second string) contracts.QueryBuilder
func (*Builder) Get ¶
func (this *Builder) Get() contracts.Collection
func (*Builder) GetBindings ¶
func (this *Builder) GetBindings() (results []interface{})
func (*Builder) Having ¶
func (this *Builder) Having(field string, args ...interface{}) contracts.QueryBuilder
func (*Builder) InRandomOrder ¶ added in v0.1.11
func (this *Builder) InRandomOrder(orderFunc ...contracts.OrderType) contracts.QueryBuilder
func (*Builder) InsertGetId ¶ added in v0.1.2
func (*Builder) InsertIgnoreSql ¶
func (*Builder) InsertOrIgnore ¶ added in v0.1.2
func (*Builder) InsertOrReplace ¶ added in v0.1.2
func (*Builder) InsertReplaceSql ¶
func (*Builder) JoinSub ¶
func (this *Builder) JoinSub(provider contracts.QueryProvider, as, first, condition, second string, joins ...contracts.JoinType) contracts.QueryBuilder
func (*Builder) LeftJoin ¶
func (this *Builder) LeftJoin(table string, first, condition, second string) contracts.QueryBuilder
func (*Builder) OrHaving ¶
func (this *Builder) OrHaving(field string, args ...interface{}) contracts.QueryBuilder
func (*Builder) OrWhere ¶
func (this *Builder) OrWhere(field string, args ...interface{}) contracts.QueryBuilder
func (*Builder) OrWhereBetween ¶
func (this *Builder) OrWhereBetween(field string, args interface{}) contracts.QueryBuilder
func (*Builder) OrWhereExists ¶
func (this *Builder) OrWhereExists(provider contracts.QueryProvider) contracts.QueryBuilder
func (*Builder) OrWhereFunc ¶
func (this *Builder) OrWhereFunc(callback contracts.QueryFunc) contracts.QueryBuilder
func (*Builder) OrWhereIn ¶
func (this *Builder) OrWhereIn(field string, args interface{}) contracts.QueryBuilder
func (*Builder) OrWhereIsNull ¶
func (this *Builder) OrWhereIsNull(field string) contracts.QueryBuilder
func (*Builder) OrWhereNotBetween ¶
func (this *Builder) OrWhereNotBetween(field string, args interface{}) contracts.QueryBuilder
func (*Builder) OrWhereNotExists ¶
func (this *Builder) OrWhereNotExists(provider contracts.QueryProvider) contracts.QueryBuilder
func (*Builder) OrWhereNotIn ¶
func (this *Builder) OrWhereNotIn(field string, args interface{}) contracts.QueryBuilder
func (*Builder) OrWhereNotNull ¶
func (this *Builder) OrWhereNotNull(field string) contracts.QueryBuilder
func (*Builder) OrderByDesc ¶
func (this *Builder) OrderByDesc(field string) contracts.QueryBuilder
func (*Builder) RightJoin ¶
func (this *Builder) RightJoin(table string, first, condition, second string) contracts.QueryBuilder
func (*Builder) SelectForUpdate ¶ added in v0.1.13
func (this *Builder) SelectForUpdate() contracts.Collection
func (*Builder) SelectForUpdateSql ¶ added in v0.1.13
func (*Builder) SelectSub ¶
func (this *Builder) SelectSub(provider contracts.QueryProvider, as string) contracts.QueryBuilder
func (*Builder) SetExecutor ¶ added in v0.1.8
func (this *Builder) SetExecutor(executor contracts.SqlExecutor) contracts.QueryBuilder
func (*Builder) SimplePaginate ¶
func (this *Builder) SimplePaginate(perPage int64, current ...int64) contracts.Collection
func (*Builder) Union ¶
func (this *Builder) Union(builder contracts.QueryBuilder, unionType ...contracts.UnionJoinType) contracts.QueryBuilder
func (*Builder) UnionAll ¶
func (this *Builder) UnionAll(builder contracts.QueryBuilder) contracts.QueryBuilder
func (*Builder) UnionAllByProvider ¶
func (this *Builder) UnionAllByProvider(builder contracts.QueryProvider) contracts.QueryBuilder
func (*Builder) UnionByProvider ¶
func (this *Builder) UnionByProvider(builder contracts.QueryProvider, unionType ...contracts.UnionJoinType) contracts.QueryBuilder
func (*Builder) UpdateOrCreate ¶ added in v0.1.2
func (*Builder) UpdateOrInsert ¶ added in v0.1.2
func (*Builder) When ¶
func (this *Builder) When(condition bool, callback contracts.QueryCallback, elseCallback ...contracts.QueryCallback) contracts.QueryBuilder
func (*Builder) Where ¶
func (this *Builder) Where(field string, args ...interface{}) contracts.QueryBuilder
func (*Builder) WhereBetween ¶
func (this *Builder) WhereBetween(field string, args interface{}, whereType ...contracts.WhereJoinType) contracts.QueryBuilder
WhereBetween args 参数可以是整数、浮点数、字符串、interface{} 等类型的数组,或者用` and `隔开的字符串,或者在源码中了解更多 https://github.com/goal-web/querybuilder/blob/78bcc832604bfcdb68579e3dd1441796a16994cf/builder.go#L74
func (*Builder) WhereExists ¶
func (this *Builder) WhereExists(provider contracts.QueryProvider, where ...contracts.WhereJoinType) contracts.QueryBuilder
func (*Builder) WhereFields ¶ added in v0.1.4
func (this *Builder) WhereFields(fields contracts.Fields) contracts.QueryBuilder
func (*Builder) WhereFunc ¶
func (this *Builder) WhereFunc(callback contracts.QueryFunc, whereType ...contracts.WhereJoinType) contracts.QueryBuilder
func (*Builder) WhereIn ¶
func (this *Builder) WhereIn(field string, args interface{}, joinType ...contracts.WhereJoinType) contracts.QueryBuilder
WhereIn args 参数可以是整数、浮点数、字符串、interface{} 等类型的数组,或者用` and `隔开的字符串,或者在源码中了解更多 https://github.com/goal-web/querybuilder/blob/78bcc832604bfcdb68579e3dd1441796a16994cf/builder.go#L74
func (*Builder) WhereIsNull ¶
func (this *Builder) WhereIsNull(field string, whereType ...contracts.WhereJoinType) contracts.QueryBuilder
func (*Builder) WhereNotBetween ¶
func (this *Builder) WhereNotBetween(field string, args interface{}, whereType ...contracts.WhereJoinType) contracts.QueryBuilder
func (*Builder) WhereNotExists ¶
func (this *Builder) WhereNotExists(provider contracts.QueryProvider, where ...contracts.WhereJoinType) contracts.QueryBuilder
func (*Builder) WhereNotIn ¶
func (this *Builder) WhereNotIn(field string, args interface{}, joinType ...contracts.WhereJoinType) contracts.QueryBuilder
func (*Builder) WhereNotNull ¶
func (this *Builder) WhereNotNull(field string, whereType ...contracts.WhereJoinType) contracts.QueryBuilder
func (*Builder) WithAvg ¶ added in v0.1.2
func (this *Builder) WithAvg(field string, as ...string) contracts.QueryBuilder
func (*Builder) WithCount ¶ added in v0.1.2
func (this *Builder) WithCount(fields ...string) contracts.QueryBuilder
func (*Builder) WithMax ¶ added in v0.1.2
func (this *Builder) WithMax(field string, as ...string) contracts.QueryBuilder
func (*Builder) WithMin ¶ added in v0.1.2
func (this *Builder) WithMin(field string, as ...string) contracts.QueryBuilder
func (*Builder) WithPagination ¶
func (this *Builder) WithPagination(perPage int64, current ...int64) contracts.QueryBuilder
type Expression ¶ added in v0.1.14
type Expression string
type OrderByFields ¶
type OrderByFields []OrderBy
func (OrderByFields) IsEmpty ¶
func (this OrderByFields) IsEmpty() bool
func (OrderByFields) String ¶
func (this OrderByFields) String() string
type ParamException ¶
type ParamException struct {
// contains filtered or unexported fields
}
func (ParamException) Error ¶
func (p ParamException) Error() string
func (ParamException) Fields ¶
func (p ParamException) Fields() contracts.Fields
type Unions ¶
type Unions map[contracts.UnionJoinType][]contracts.QueryBuilder
Click to show internal directories.
Click to hide internal directories.