Documentation
¶
Index ¶
- Variables
- func ApplySort(query SelectQuery, orders []sortx.OrderSpec)
- func Names(ns ...string) schema.QueryAppender
- type Applier
- type ApplyFunc
- type ArrayAggBuilder
- type AuditConditionBuilder
- type AuditedModel
- type AvgBuilder
- type BaseAggregate
- type BaseQueryBuilder
- func (b *BaseQueryBuilder) BuildCondition(builder func(ConditionBuilder)) interface{ ... }
- func (b *BaseQueryBuilder) BuildSubQuery(builder func(query SelectQuery)) *bun.SelectQuery
- func (b *BaseQueryBuilder) CreateSubQuery(subQuery *bun.SelectQuery) SelectQuery
- func (b *BaseQueryBuilder) Dialect() schema.Dialect
- func (b *BaseQueryBuilder) ExprBuilder() ExprBuilder
- func (b *BaseQueryBuilder) GetTable() *schema.Table
- func (b *BaseQueryBuilder) Query() bun.Query
- func (b *BaseQueryBuilder) String() string
- type BaseWindowPartitionBuilder
- type BitAndBuilder
- type BitOrBuilder
- type BoolAndBuilder
- type BoolOrBuilder
- type BunDB
- func (d *BunDB) ModelPKFields(model any) []*PKField
- func (d *BunDB) ModelPKs(model any) (map[string]any, error)
- func (d *BunDB) NewDelete() DeleteQuery
- func (d *BunDB) NewInsert() InsertQuery
- func (d *BunDB) NewMerge() MergeQuery
- func (d *BunDB) NewRaw(query string, args ...any) RawQuery
- func (d *BunDB) NewSelect() SelectQuery
- func (d *BunDB) NewUpdate() UpdateQuery
- func (d *BunDB) RunInReadOnlyTX(ctx context.Context, fn func(context.Context, DB) error) error
- func (d *BunDB) RunInTX(ctx context.Context, fn func(context.Context, DB) error) error
- func (d *BunDB) TableOf(model any) *schema.Table
- func (d *BunDB) Unwrap() bun.IDB
- func (d *BunDB) WithNamedArg(name string, value any) DB
- type BunDeleteQuery
- func (q *BunDeleteQuery) Apply(fns ...ApplyFunc[DeleteQuery]) DeleteQuery
- func (q *BunDeleteQuery) ApplyIf(condition bool, fns ...ApplyFunc[DeleteQuery]) DeleteQuery
- func (q *BunDeleteQuery) DB() DB
- func (q *BunDeleteQuery) Exec(ctx context.Context, dest ...any) (sql.Result, error)
- func (q *BunDeleteQuery) ForceDelete() DeleteQuery
- func (q *BunDeleteQuery) IncludeDeleted() DeleteQuery
- func (q *BunDeleteQuery) Limit(limit int) DeleteQuery
- func (q *BunDeleteQuery) Model(model any) DeleteQuery
- func (q *BunDeleteQuery) ModelTable(name string, alias ...string) DeleteQuery
- func (q *BunDeleteQuery) OrderBy(columns ...string) DeleteQuery
- func (q *BunDeleteQuery) OrderByDesc(columns ...string) DeleteQuery
- func (q *BunDeleteQuery) OrderByExpr(builder func(ExprBuilder) any) DeleteQuery
- func (q *BunDeleteQuery) Returning(columns ...string) DeleteQuery
- func (q *BunDeleteQuery) ReturningAll() DeleteQuery
- func (q *BunDeleteQuery) ReturningNone() DeleteQuery
- func (q *BunDeleteQuery) Scan(ctx context.Context, dest ...any) error
- func (q *BunDeleteQuery) Table(name string, alias ...string) DeleteQuery
- func (q *BunDeleteQuery) TableExpr(builder func(ExprBuilder) any, alias ...string) DeleteQuery
- func (q *BunDeleteQuery) TableFrom(model any, alias ...string) DeleteQuery
- func (q *BunDeleteQuery) TableSubQuery(builder func(SelectQuery), alias ...string) DeleteQuery
- func (q *BunDeleteQuery) Unwrap() *bun.DeleteQuery
- func (q *BunDeleteQuery) Where(builder func(ConditionBuilder)) DeleteQuery
- func (q *BunDeleteQuery) WhereDeleted() DeleteQuery
- func (q *BunDeleteQuery) WherePK(columns ...string) DeleteQuery
- func (q *BunDeleteQuery) With(name string, builder func(SelectQuery)) DeleteQuery
- func (q *BunDeleteQuery) WithRecursive(name string, builder func(SelectQuery)) DeleteQuery
- func (q *BunDeleteQuery) WithValues(name string, model any, withOrder ...bool) DeleteQuery
- type BunInsertQuery
- func (q *BunInsertQuery) Apply(fns ...ApplyFunc[InsertQuery]) InsertQuery
- func (q *BunInsertQuery) ApplyIf(condition bool, fns ...ApplyFunc[InsertQuery]) InsertQuery
- func (q *BunInsertQuery) Column(name string, value any) InsertQuery
- func (q *BunInsertQuery) ColumnExpr(name string, builder func(ExprBuilder) any) InsertQuery
- func (q *BunInsertQuery) DB() DB
- func (q *BunInsertQuery) Exclude(columns ...string) InsertQuery
- func (q *BunInsertQuery) ExcludeAll() InsertQuery
- func (q *BunInsertQuery) Exec(ctx context.Context, dest ...any) (sql.Result, error)
- func (q *BunInsertQuery) Model(model any) InsertQuery
- func (q *BunInsertQuery) ModelTable(name string, alias ...string) InsertQuery
- func (q *BunInsertQuery) OnConflict(builder func(ConflictBuilder)) InsertQuery
- func (q *BunInsertQuery) Returning(columns ...string) InsertQuery
- func (q *BunInsertQuery) ReturningAll() InsertQuery
- func (q *BunInsertQuery) ReturningNone() InsertQuery
- func (q *BunInsertQuery) Scan(ctx context.Context, dest ...any) error
- func (q *BunInsertQuery) Select(columns ...string) InsertQuery
- func (q *BunInsertQuery) SelectAll() InsertQuery
- func (q *BunInsertQuery) Table(name string, alias ...string) InsertQuery
- func (q *BunInsertQuery) TableExpr(builder func(ExprBuilder) any, alias ...string) InsertQuery
- func (q *BunInsertQuery) TableFrom(model any, alias ...string) InsertQuery
- func (q *BunInsertQuery) TableSubQuery(builder func(SelectQuery), alias ...string) InsertQuery
- func (q *BunInsertQuery) Unwrap() *bun.InsertQuery
- func (q *BunInsertQuery) With(name string, builder func(SelectQuery)) InsertQuery
- func (q *BunInsertQuery) WithRecursive(name string, builder func(SelectQuery)) InsertQuery
- func (q *BunInsertQuery) WithValues(name string, model any, withOrder ...bool) InsertQuery
- type BunMergeQuery
- func (q *BunMergeQuery) Apply(fns ...ApplyFunc[MergeQuery]) MergeQuery
- func (q *BunMergeQuery) ApplyIf(condition bool, fns ...ApplyFunc[MergeQuery]) MergeQuery
- func (q *BunMergeQuery) DB() DB
- func (q *BunMergeQuery) Exec(ctx context.Context, dest ...any) (sql.Result, error)
- func (q *BunMergeQuery) Model(model any) MergeQuery
- func (q *BunMergeQuery) ModelTable(name string, alias ...string) MergeQuery
- func (q *BunMergeQuery) On(builder func(ConditionBuilder)) MergeQuery
- func (q *BunMergeQuery) Returning(columns ...string) MergeQuery
- func (q *BunMergeQuery) ReturningAll() MergeQuery
- func (q *BunMergeQuery) ReturningNone() MergeQuery
- func (q *BunMergeQuery) Scan(ctx context.Context, dest ...any) error
- func (q *BunMergeQuery) Table(name string, alias ...string) MergeQuery
- func (q *BunMergeQuery) TableExpr(builder func(ExprBuilder) any, alias ...string) MergeQuery
- func (q *BunMergeQuery) TableFrom(model any, alias ...string) MergeQuery
- func (q *BunMergeQuery) TableSubQuery(builder func(SelectQuery), alias ...string) MergeQuery
- func (q *BunMergeQuery) Unwrap() *bun.MergeQuery
- func (q *BunMergeQuery) Using(model any, alias ...string) MergeQuery
- func (q *BunMergeQuery) UsingExpr(builder func(ExprBuilder) any, alias ...string) MergeQuery
- func (q *BunMergeQuery) UsingSubQuery(builder func(SelectQuery), alias ...string) MergeQuery
- func (q *BunMergeQuery) UsingTable(table string, alias ...string) MergeQuery
- func (q *BunMergeQuery) WhenMatched(builder ...func(ConditionBuilder)) MergeWhenBuilder
- func (q *BunMergeQuery) WhenNotMatched(builder ...func(ConditionBuilder)) MergeWhenBuilder
- func (q *BunMergeQuery) WhenNotMatchedBySource(builder ...func(ConditionBuilder)) MergeWhenBuilder
- func (q *BunMergeQuery) WhenNotMatchedByTarget(builder ...func(ConditionBuilder)) MergeWhenBuilder
- func (q *BunMergeQuery) With(name string, builder func(SelectQuery)) MergeQuery
- func (q *BunMergeQuery) WithRecursive(name string, builder func(SelectQuery)) MergeQuery
- func (q *BunMergeQuery) WithValues(name string, model any, withOrder ...bool) MergeQuery
- type BunSelectQuery
- func (q *BunSelectQuery) Apply(fns ...ApplyFunc[SelectQuery]) SelectQuery
- func (q *BunSelectQuery) ApplyIf(condition bool, fns ...ApplyFunc[SelectQuery]) SelectQuery
- func (q *BunSelectQuery) Count(ctx context.Context) (int64, error)
- func (q *BunSelectQuery) CrossJoin(model any, alias ...string) SelectQuery
- func (q *BunSelectQuery) CrossJoinExpr(eBuilder func(ExprBuilder) any, alias ...string) SelectQuery
- func (q *BunSelectQuery) CrossJoinSubQuery(sqBuilder func(query SelectQuery), alias ...string) SelectQuery
- func (q *BunSelectQuery) CrossJoinTable(name string, alias ...string) SelectQuery
- func (q *BunSelectQuery) DB() DB
- func (q *BunSelectQuery) Distinct() SelectQuery
- func (q *BunSelectQuery) DistinctOnColumns(columns ...string) SelectQuery
- func (q *BunSelectQuery) DistinctOnExpr(builder func(ExprBuilder) any) SelectQuery
- func (q *BunSelectQuery) Except(builder func(query SelectQuery)) SelectQuery
- func (q *BunSelectQuery) ExceptAll(builder func(query SelectQuery)) SelectQuery
- func (q *BunSelectQuery) Exclude(columns ...string) SelectQuery
- func (q *BunSelectQuery) ExcludeAll() SelectQuery
- func (q *BunSelectQuery) Exec(ctx context.Context, dest ...any) (res sql.Result, err error)
- func (q *BunSelectQuery) Exists(ctx context.Context) (bool, error)
- func (q *BunSelectQuery) ForShare(tables ...string) SelectQuery
- func (q *BunSelectQuery) ForShareNoWait(tables ...string) SelectQuery
- func (q *BunSelectQuery) ForShareSkipLocked(tables ...string) SelectQuery
- func (q *BunSelectQuery) ForUpdate(tables ...string) SelectQuery
- func (q *BunSelectQuery) ForUpdateNoWait(tables ...string) SelectQuery
- func (q *BunSelectQuery) ForUpdateSkipLocked(tables ...string) SelectQuery
- func (q *BunSelectQuery) FullJoin(model any, builder func(ConditionBuilder), alias ...string) SelectQuery
- func (q *BunSelectQuery) FullJoinExpr(eBuilder func(ExprBuilder) any, cBuilder func(ConditionBuilder), ...) SelectQuery
- func (q *BunSelectQuery) FullJoinSubQuery(sqBuilder func(query SelectQuery), cBuilder func(ConditionBuilder), ...) SelectQuery
- func (q *BunSelectQuery) FullJoinTable(name string, builder func(ConditionBuilder), alias ...string) SelectQuery
- func (q *BunSelectQuery) GroupBy(columns ...string) SelectQuery
- func (q *BunSelectQuery) GroupByExpr(builder func(ExprBuilder) any) SelectQuery
- func (q *BunSelectQuery) Having(builder func(ConditionBuilder)) SelectQuery
- func (q *BunSelectQuery) IncludeDeleted() SelectQuery
- func (q *BunSelectQuery) Intersect(builder func(query SelectQuery)) SelectQuery
- func (q *BunSelectQuery) IntersectAll(builder func(query SelectQuery)) SelectQuery
- func (q *BunSelectQuery) Join(model any, builder func(ConditionBuilder), alias ...string) SelectQuery
- func (q *BunSelectQuery) JoinExpr(eBuilder func(ExprBuilder) any, cBuilder func(ConditionBuilder), ...) SelectQuery
- func (q *BunSelectQuery) JoinRelations(specs ...*RelationSpec) SelectQuery
- func (q *BunSelectQuery) JoinSubQuery(sqBuilder func(query SelectQuery), cBuilder func(ConditionBuilder), ...) SelectQuery
- func (q *BunSelectQuery) JoinTable(name string, builder func(ConditionBuilder), alias ...string) SelectQuery
- func (q *BunSelectQuery) LeftJoin(model any, builder func(ConditionBuilder), alias ...string) SelectQuery
- func (q *BunSelectQuery) LeftJoinExpr(eBuilder func(ExprBuilder) any, cBuilder func(ConditionBuilder), ...) SelectQuery
- func (q *BunSelectQuery) LeftJoinSubQuery(sqBuilder func(query SelectQuery), cBuilder func(ConditionBuilder), ...) SelectQuery
- func (q *BunSelectQuery) LeftJoinTable(name string, builder func(ConditionBuilder), alias ...string) SelectQuery
- func (q *BunSelectQuery) Limit(limit int) SelectQuery
- func (q *BunSelectQuery) Model(model any) SelectQuery
- func (q *BunSelectQuery) ModelTable(name string, alias ...string) SelectQuery
- func (q *BunSelectQuery) Offset(offset int) SelectQuery
- func (q *BunSelectQuery) OrderBy(columns ...string) SelectQuery
- func (q *BunSelectQuery) OrderByDesc(columns ...string) SelectQuery
- func (q *BunSelectQuery) OrderByExpr(builder func(ExprBuilder) any) SelectQuery
- func (q *BunSelectQuery) Paginate(pageable page.Pageable) SelectQuery
- func (q *BunSelectQuery) Relation(name string, apply ...func(query SelectQuery)) SelectQuery
- func (q *BunSelectQuery) RightJoin(model any, builder func(ConditionBuilder), alias ...string) SelectQuery
- func (q *BunSelectQuery) RightJoinExpr(eBuilder func(ExprBuilder) any, cBuilder func(ConditionBuilder), ...) SelectQuery
- func (q *BunSelectQuery) RightJoinSubQuery(sqBuilder func(query SelectQuery), cBuilder func(ConditionBuilder), ...) SelectQuery
- func (q *BunSelectQuery) RightJoinTable(name string, builder func(ConditionBuilder), alias ...string) SelectQuery
- func (q *BunSelectQuery) Rows(ctx context.Context) (rows *sql.Rows, err error)
- func (q *BunSelectQuery) Scan(ctx context.Context, dest ...any) (err error)
- func (q *BunSelectQuery) ScanAndCount(ctx context.Context, dest ...any) (int64, error)
- func (q *BunSelectQuery) Select(columns ...string) SelectQuery
- func (q *BunSelectQuery) SelectAll() SelectQuery
- func (q *BunSelectQuery) SelectAs(column, alias string) SelectQuery
- func (q *BunSelectQuery) SelectExpr(builder func(ExprBuilder) any, alias ...string) SelectQuery
- func (q *BunSelectQuery) SelectModelColumns() SelectQuery
- func (q *BunSelectQuery) SelectModelPKs() SelectQuery
- func (q *BunSelectQuery) Table(name string, alias ...string) SelectQuery
- func (q *BunSelectQuery) TableExpr(builder func(ExprBuilder) any, alias ...string) SelectQuery
- func (q *BunSelectQuery) TableFrom(model any, alias ...string) SelectQuery
- func (q *BunSelectQuery) TableSubQuery(builder func(query SelectQuery), alias ...string) SelectQuery
- func (q *BunSelectQuery) Union(builder func(query SelectQuery)) SelectQuery
- func (q *BunSelectQuery) UnionAll(builder func(query SelectQuery)) SelectQuery
- func (q *BunSelectQuery) Unwrap() *bun.SelectQuery
- func (q *BunSelectQuery) Where(builder func(ConditionBuilder)) SelectQuery
- func (q *BunSelectQuery) WhereDeleted() SelectQuery
- func (q *BunSelectQuery) WherePK(columns ...string) SelectQuery
- func (q *BunSelectQuery) With(name string, builder func(query SelectQuery)) SelectQuery
- func (q *BunSelectQuery) WithRecursive(name string, builder func(query SelectQuery)) SelectQuery
- func (q *BunSelectQuery) WithValues(name string, model any, withOrder ...bool) SelectQuery
- type BunUpdateQuery
- func (q *BunUpdateQuery) Apply(fns ...ApplyFunc[UpdateQuery]) UpdateQuery
- func (q *BunUpdateQuery) ApplyIf(condition bool, fns ...ApplyFunc[UpdateQuery]) UpdateQuery
- func (q *BunUpdateQuery) Bulk() UpdateQuery
- func (q *BunUpdateQuery) Column(name string, value any) UpdateQuery
- func (q *BunUpdateQuery) ColumnExpr(name string, builder func(ExprBuilder) any) UpdateQuery
- func (q *BunUpdateQuery) DB() DB
- func (q *BunUpdateQuery) Exclude(columns ...string) UpdateQuery
- func (q *BunUpdateQuery) ExcludeAll() UpdateQuery
- func (q *BunUpdateQuery) Exec(ctx context.Context, dest ...any) (sql.Result, error)
- func (q *BunUpdateQuery) IncludeDeleted() UpdateQuery
- func (q *BunUpdateQuery) Limit(limit int) UpdateQuery
- func (q *BunUpdateQuery) Model(model any) UpdateQuery
- func (q *BunUpdateQuery) ModelTable(name string, alias ...string) UpdateQuery
- func (q *BunUpdateQuery) OmitZero() UpdateQuery
- func (q *BunUpdateQuery) OrderBy(columns ...string) UpdateQuery
- func (q *BunUpdateQuery) OrderByDesc(columns ...string) UpdateQuery
- func (q *BunUpdateQuery) OrderByExpr(builder func(ExprBuilder) any) UpdateQuery
- func (q *BunUpdateQuery) Returning(columns ...string) UpdateQuery
- func (q *BunUpdateQuery) ReturningAll() UpdateQuery
- func (q *BunUpdateQuery) ReturningNone() UpdateQuery
- func (q *BunUpdateQuery) Scan(ctx context.Context, dest ...any) error
- func (q *BunUpdateQuery) Select(columns ...string) UpdateQuery
- func (q *BunUpdateQuery) SelectAll() UpdateQuery
- func (q *BunUpdateQuery) Set(name string, value any) UpdateQuery
- func (q *BunUpdateQuery) SetExpr(name string, builder func(ExprBuilder) any) UpdateQuery
- func (q *BunUpdateQuery) Table(name string, alias ...string) UpdateQuery
- func (q *BunUpdateQuery) TableExpr(builder func(ExprBuilder) any, alias ...string) UpdateQuery
- func (q *BunUpdateQuery) TableFrom(model any, alias ...string) UpdateQuery
- func (q *BunUpdateQuery) TableSubQuery(builder func(SelectQuery), alias ...string) UpdateQuery
- func (q *BunUpdateQuery) Unwrap() *bun.UpdateQuery
- func (q *BunUpdateQuery) Where(builder func(ConditionBuilder)) UpdateQuery
- func (q *BunUpdateQuery) WhereDeleted() UpdateQuery
- func (q *BunUpdateQuery) WherePK(columns ...string) UpdateQuery
- func (q *BunUpdateQuery) With(name string, builder func(SelectQuery)) UpdateQuery
- func (q *BunUpdateQuery) WithRecursive(name string, builder func(SelectQuery)) UpdateQuery
- func (q *BunUpdateQuery) WithValues(name string, model any, withOrder ...bool) UpdateQuery
- type CTE
- type CaseBuilder
- type CaseWhenBuilder
- type ClauseConditionBuilder
- func (cb *ClauseConditionBuilder) And(query string, args ...any)
- func (cb *ClauseConditionBuilder) AppendConditions(conditions ...schema.QueryWithSep)
- func (cb *ClauseConditionBuilder) AppendGroup(sep string, conditions []schema.QueryWithSep)
- func (cb *ClauseConditionBuilder) AppendQuery(gen schema.QueryGen, b []byte) (_ []byte, err error)
- func (cb *ClauseConditionBuilder) BuildGroup(sep string, builder func(ConditionBuilder))
- func (cb *ClauseConditionBuilder) Or(query string, args ...any)
- type ColumnHandler
- type ColumnInfo
- type ColumnUpdatable
- type ConditionBuilder
- type ConflictAction
- type ConflictBuilder
- type ConflictUpdateBuilder
- type CountBuilder
- type CreatedAtHandler
- type CreatedByHandler
- type CreatedModel
- type CriteriaBuilder
- func (cb *CriteriaBuilder) Apply(fns ...ApplyFunc[ConditionBuilder]) ConditionBuilder
- func (cb *CriteriaBuilder) ApplyIf(condition bool, fns ...ApplyFunc[ConditionBuilder]) ConditionBuilder
- func (cb *CriteriaBuilder) Between(column string, start, end any) ConditionBuilder
- func (cb *CriteriaBuilder) BetweenExpr(column string, startB, endB func(ExprBuilder) any) ConditionBuilder
- func (cb *CriteriaBuilder) Contains(column, value string) ConditionBuilder
- func (cb *CriteriaBuilder) ContainsAny(column string, values []string) ConditionBuilder
- func (cb *CriteriaBuilder) ContainsAnyIgnoreCase(column string, values []string) ConditionBuilder
- func (cb *CriteriaBuilder) ContainsIgnoreCase(column, value string) ConditionBuilder
- func (cb *CriteriaBuilder) CreatedAtBetween(start, end time.Time, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) CreatedAtGreaterThan(createdAt time.Time, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) CreatedAtGreaterThanOrEqual(createdAt time.Time, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) CreatedAtLessThan(createdAt time.Time, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) CreatedAtLessThanOrEqual(createdAt time.Time, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) CreatedAtNotBetween(start, end time.Time, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) CreatedByEquals(createdBy string, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) CreatedByEqualsAll(builder func(SelectQuery), alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) CreatedByEqualsAny(builder func(SelectQuery), alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) CreatedByEqualsCurrent(alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) CreatedByEqualsSubQuery(builder func(SelectQuery), alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) CreatedByIn(createdBys []string, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) CreatedByInSubQuery(builder func(SelectQuery), alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) CreatedByNotEquals(createdBy string, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) CreatedByNotEqualsAll(builder func(SelectQuery), alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) CreatedByNotEqualsAny(builder func(SelectQuery), alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) CreatedByNotEqualsCurrent(alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) CreatedByNotEqualsSubQuery(builder func(SelectQuery), alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) CreatedByNotIn(createdBys []string, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) CreatedByNotInSubQuery(builder func(SelectQuery), alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) EndsWith(column, value string) ConditionBuilder
- func (cb *CriteriaBuilder) EndsWithAny(column string, values []string) ConditionBuilder
- func (cb *CriteriaBuilder) EndsWithAnyIgnoreCase(column string, values []string) ConditionBuilder
- func (cb *CriteriaBuilder) EndsWithIgnoreCase(column, value string) ConditionBuilder
- func (cb *CriteriaBuilder) Equals(column string, value any) ConditionBuilder
- func (cb *CriteriaBuilder) EqualsAll(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) EqualsAny(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) EqualsColumn(column1, column2 string) ConditionBuilder
- func (cb *CriteriaBuilder) EqualsExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
- func (cb *CriteriaBuilder) EqualsSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) Expr(builder func(ExprBuilder) any) ConditionBuilder
- func (cb *CriteriaBuilder) GreaterThan(column string, value any) ConditionBuilder
- func (cb *CriteriaBuilder) GreaterThanAll(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) GreaterThanAny(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) GreaterThanColumn(column1, column2 string) ConditionBuilder
- func (cb *CriteriaBuilder) GreaterThanExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
- func (cb *CriteriaBuilder) GreaterThanOrEqual(column string, value any) ConditionBuilder
- func (cb *CriteriaBuilder) GreaterThanOrEqualAll(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) GreaterThanOrEqualAny(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) GreaterThanOrEqualColumn(column1, column2 string) ConditionBuilder
- func (cb *CriteriaBuilder) GreaterThanOrEqualExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
- func (cb *CriteriaBuilder) GreaterThanOrEqualSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) GreaterThanSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) Group(builder func(ConditionBuilder)) ConditionBuilder
- func (cb *CriteriaBuilder) In(column string, values any) ConditionBuilder
- func (cb *CriteriaBuilder) InExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
- func (cb *CriteriaBuilder) InSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) IsFalse(column string) ConditionBuilder
- func (cb *CriteriaBuilder) IsFalseExpr(builder func(ExprBuilder) any) ConditionBuilder
- func (cb *CriteriaBuilder) IsFalseSubQuery(builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) IsNotNull(column string) ConditionBuilder
- func (cb *CriteriaBuilder) IsNotNullExpr(builder func(ExprBuilder) any) ConditionBuilder
- func (cb *CriteriaBuilder) IsNotNullSubQuery(builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) IsNull(column string) ConditionBuilder
- func (cb *CriteriaBuilder) IsNullExpr(builder func(ExprBuilder) any) ConditionBuilder
- func (cb *CriteriaBuilder) IsNullSubQuery(builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) IsTrue(column string) ConditionBuilder
- func (cb *CriteriaBuilder) IsTrueExpr(builder func(ExprBuilder) any) ConditionBuilder
- func (cb *CriteriaBuilder) IsTrueSubQuery(builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) LessThan(column string, value any) ConditionBuilder
- func (cb *CriteriaBuilder) LessThanAll(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) LessThanAny(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) LessThanColumn(column1, column2 string) ConditionBuilder
- func (cb *CriteriaBuilder) LessThanExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
- func (cb *CriteriaBuilder) LessThanOrEqual(column string, value any) ConditionBuilder
- func (cb *CriteriaBuilder) LessThanOrEqualAll(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) LessThanOrEqualAny(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) LessThanOrEqualColumn(column1, column2 string) ConditionBuilder
- func (cb *CriteriaBuilder) LessThanOrEqualExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
- func (cb *CriteriaBuilder) LessThanOrEqualSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) LessThanSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) NotBetween(column string, start, end any) ConditionBuilder
- func (cb *CriteriaBuilder) NotBetweenExpr(column string, startB, endB func(ExprBuilder) any) ConditionBuilder
- func (cb *CriteriaBuilder) NotContains(column, value string) ConditionBuilder
- func (cb *CriteriaBuilder) NotContainsAny(column string, values []string) ConditionBuilder
- func (cb *CriteriaBuilder) NotContainsAnyIgnoreCase(column string, values []string) ConditionBuilder
- func (cb *CriteriaBuilder) NotContainsIgnoreCase(column, value string) ConditionBuilder
- func (cb *CriteriaBuilder) NotEndsWith(column, value string) ConditionBuilder
- func (cb *CriteriaBuilder) NotEndsWithAny(column string, values []string) ConditionBuilder
- func (cb *CriteriaBuilder) NotEndsWithAnyIgnoreCase(column string, values []string) ConditionBuilder
- func (cb *CriteriaBuilder) NotEndsWithIgnoreCase(column, value string) ConditionBuilder
- func (cb *CriteriaBuilder) NotEquals(column string, value any) ConditionBuilder
- func (cb *CriteriaBuilder) NotEqualsAll(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) NotEqualsAny(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) NotEqualsColumn(column1, column2 string) ConditionBuilder
- func (cb *CriteriaBuilder) NotEqualsExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
- func (cb *CriteriaBuilder) NotEqualsSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) NotIn(column string, values any) ConditionBuilder
- func (cb *CriteriaBuilder) NotInExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
- func (cb *CriteriaBuilder) NotInSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) NotStartsWith(column, value string) ConditionBuilder
- func (cb *CriteriaBuilder) NotStartsWithAny(column string, values []string) ConditionBuilder
- func (cb *CriteriaBuilder) NotStartsWithAnyIgnoreCase(column string, values []string) ConditionBuilder
- func (cb *CriteriaBuilder) NotStartsWithIgnoreCase(column, value string) ConditionBuilder
- func (cb *CriteriaBuilder) OrBetween(column string, start, end any) ConditionBuilder
- func (cb *CriteriaBuilder) OrBetweenExpr(column string, startB, endB func(ExprBuilder) any) ConditionBuilder
- func (cb *CriteriaBuilder) OrContains(column, value string) ConditionBuilder
- func (cb *CriteriaBuilder) OrContainsAny(column string, values []string) ConditionBuilder
- func (cb *CriteriaBuilder) OrContainsAnyIgnoreCase(column string, values []string) ConditionBuilder
- func (cb *CriteriaBuilder) OrContainsIgnoreCase(column, value string) ConditionBuilder
- func (cb *CriteriaBuilder) OrCreatedAtBetween(start, end time.Time, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrCreatedAtGreaterThan(createdAt time.Time, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrCreatedAtGreaterThanOrEqual(createdAt time.Time, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrCreatedAtLessThan(createdAt time.Time, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrCreatedAtLessThanOrEqual(createdAt time.Time, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrCreatedAtNotBetween(start, end time.Time, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrCreatedByEquals(createdBy string, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrCreatedByEqualsAll(builder func(SelectQuery), alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrCreatedByEqualsAny(builder func(SelectQuery), alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrCreatedByEqualsCurrent(alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrCreatedByEqualsSubQuery(builder func(SelectQuery), alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrCreatedByIn(createdBys []string, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrCreatedByInSubQuery(builder func(SelectQuery), alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrCreatedByNotEquals(createdBy string, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrCreatedByNotEqualsAll(builder func(SelectQuery), alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrCreatedByNotEqualsAny(builder func(SelectQuery), alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrCreatedByNotEqualsCurrent(alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrCreatedByNotEqualsSubQuery(builder func(SelectQuery), alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrCreatedByNotIn(createdBys []string, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrCreatedByNotInSubQuery(builder func(SelectQuery), alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrEndsWith(column, value string) ConditionBuilder
- func (cb *CriteriaBuilder) OrEndsWithAny(column string, values []string) ConditionBuilder
- func (cb *CriteriaBuilder) OrEndsWithAnyIgnoreCase(column string, values []string) ConditionBuilder
- func (cb *CriteriaBuilder) OrEndsWithIgnoreCase(column, value string) ConditionBuilder
- func (cb *CriteriaBuilder) OrEquals(column string, value any) ConditionBuilder
- func (cb *CriteriaBuilder) OrEqualsAll(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) OrEqualsAny(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) OrEqualsColumn(column1, column2 string) ConditionBuilder
- func (cb *CriteriaBuilder) OrEqualsExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
- func (cb *CriteriaBuilder) OrEqualsSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) OrExpr(builder func(ExprBuilder) any) ConditionBuilder
- func (cb *CriteriaBuilder) OrGreaterThan(column string, value any) ConditionBuilder
- func (cb *CriteriaBuilder) OrGreaterThanAll(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) OrGreaterThanAny(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) OrGreaterThanColumn(column1, column2 string) ConditionBuilder
- func (cb *CriteriaBuilder) OrGreaterThanExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
- func (cb *CriteriaBuilder) OrGreaterThanOrEqual(column string, value any) ConditionBuilder
- func (cb *CriteriaBuilder) OrGreaterThanOrEqualAll(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) OrGreaterThanOrEqualAny(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) OrGreaterThanOrEqualColumn(column1, column2 string) ConditionBuilder
- func (cb *CriteriaBuilder) OrGreaterThanOrEqualExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
- func (cb *CriteriaBuilder) OrGreaterThanOrEqualSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) OrGreaterThanSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) OrGroup(builder func(ConditionBuilder)) ConditionBuilder
- func (cb *CriteriaBuilder) OrIn(column string, values any) ConditionBuilder
- func (cb *CriteriaBuilder) OrInExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
- func (cb *CriteriaBuilder) OrInSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) OrIsFalse(column string) ConditionBuilder
- func (cb *CriteriaBuilder) OrIsFalseExpr(builder func(ExprBuilder) any) ConditionBuilder
- func (cb *CriteriaBuilder) OrIsFalseSubQuery(builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) OrIsNotNull(column string) ConditionBuilder
- func (cb *CriteriaBuilder) OrIsNotNullExpr(builder func(ExprBuilder) any) ConditionBuilder
- func (cb *CriteriaBuilder) OrIsNotNullSubQuery(builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) OrIsNull(column string) ConditionBuilder
- func (cb *CriteriaBuilder) OrIsNullExpr(builder func(ExprBuilder) any) ConditionBuilder
- func (cb *CriteriaBuilder) OrIsNullSubQuery(builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) OrIsTrue(column string) ConditionBuilder
- func (cb *CriteriaBuilder) OrIsTrueExpr(builder func(ExprBuilder) any) ConditionBuilder
- func (cb *CriteriaBuilder) OrIsTrueSubQuery(builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) OrLessThan(column string, value any) ConditionBuilder
- func (cb *CriteriaBuilder) OrLessThanAll(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) OrLessThanAny(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) OrLessThanColumn(column1, column2 string) ConditionBuilder
- func (cb *CriteriaBuilder) OrLessThanExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
- func (cb *CriteriaBuilder) OrLessThanOrEqual(column string, value any) ConditionBuilder
- func (cb *CriteriaBuilder) OrLessThanOrEqualAll(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) OrLessThanOrEqualAny(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) OrLessThanOrEqualColumn(column1, column2 string) ConditionBuilder
- func (cb *CriteriaBuilder) OrLessThanOrEqualExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
- func (cb *CriteriaBuilder) OrLessThanOrEqualSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) OrLessThanSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) OrNotBetween(column string, start, end any) ConditionBuilder
- func (cb *CriteriaBuilder) OrNotBetweenExpr(column string, startB, endB func(ExprBuilder) any) ConditionBuilder
- func (cb *CriteriaBuilder) OrNotContains(column, value string) ConditionBuilder
- func (cb *CriteriaBuilder) OrNotContainsAny(column string, values []string) ConditionBuilder
- func (cb *CriteriaBuilder) OrNotContainsAnyIgnoreCase(column string, values []string) ConditionBuilder
- func (cb *CriteriaBuilder) OrNotContainsIgnoreCase(column, value string) ConditionBuilder
- func (cb *CriteriaBuilder) OrNotEndsWith(column, value string) ConditionBuilder
- func (cb *CriteriaBuilder) OrNotEndsWithAny(column string, values []string) ConditionBuilder
- func (cb *CriteriaBuilder) OrNotEndsWithAnyIgnoreCase(column string, values []string) ConditionBuilder
- func (cb *CriteriaBuilder) OrNotEndsWithIgnoreCase(column, value string) ConditionBuilder
- func (cb *CriteriaBuilder) OrNotEquals(column string, value any) ConditionBuilder
- func (cb *CriteriaBuilder) OrNotEqualsAll(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) OrNotEqualsAny(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) OrNotEqualsColumn(column1, column2 string) ConditionBuilder
- func (cb *CriteriaBuilder) OrNotEqualsExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
- func (cb *CriteriaBuilder) OrNotEqualsSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) OrNotIn(column string, values any) ConditionBuilder
- func (cb *CriteriaBuilder) OrNotInExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
- func (cb *CriteriaBuilder) OrNotInSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
- func (cb *CriteriaBuilder) OrNotStartsWith(column, value string) ConditionBuilder
- func (cb *CriteriaBuilder) OrNotStartsWithAny(column string, values []string) ConditionBuilder
- func (cb *CriteriaBuilder) OrNotStartsWithAnyIgnoreCase(column string, values []string) ConditionBuilder
- func (cb *CriteriaBuilder) OrNotStartsWithIgnoreCase(column, value string) ConditionBuilder
- func (cb *CriteriaBuilder) OrPKEquals(pk any, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrPKIn(pks any, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrPKNotEquals(pk any, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrPKNotIn(pks any, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrStartsWith(column, value string) ConditionBuilder
- func (cb *CriteriaBuilder) OrStartsWithAny(column string, values []string) ConditionBuilder
- func (cb *CriteriaBuilder) OrStartsWithAnyIgnoreCase(column string, values []string) ConditionBuilder
- func (cb *CriteriaBuilder) OrStartsWithIgnoreCase(column, value string) ConditionBuilder
- func (cb *CriteriaBuilder) OrUpdatedAtBetween(start, end time.Time, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrUpdatedAtGreaterThan(updatedAt time.Time, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrUpdatedAtGreaterThanOrEqual(updatedAt time.Time, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrUpdatedAtLessThan(updatedAt time.Time, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrUpdatedAtLessThanOrEqual(updatedAt time.Time, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrUpdatedAtNotBetween(start, end time.Time, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrUpdatedByEquals(updatedBy string, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrUpdatedByEqualsAll(builder func(SelectQuery), alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrUpdatedByEqualsAny(builder func(SelectQuery), alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrUpdatedByEqualsCurrent(alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrUpdatedByEqualsSubQuery(builder func(SelectQuery), alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrUpdatedByIn(updatedBys []string, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrUpdatedByInSubQuery(builder func(SelectQuery), alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrUpdatedByNotEquals(updatedBy string, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrUpdatedByNotEqualsAll(builder func(SelectQuery), alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrUpdatedByNotEqualsAny(builder func(SelectQuery), alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrUpdatedByNotEqualsCurrent(alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrUpdatedByNotEqualsSubQuery(builder func(SelectQuery), alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrUpdatedByNotIn(updatedBys []string, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) OrUpdatedByNotInSubQuery(builder func(SelectQuery), alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) PKEquals(pk any, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) PKIn(pks any, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) PKNotEquals(pk any, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) PKNotIn(pks any, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) StartsWith(column, value string) ConditionBuilder
- func (cb *CriteriaBuilder) StartsWithAny(column string, values []string) ConditionBuilder
- func (cb *CriteriaBuilder) StartsWithAnyIgnoreCase(column string, values []string) ConditionBuilder
- func (cb *CriteriaBuilder) StartsWithIgnoreCase(column, value string) ConditionBuilder
- func (cb *CriteriaBuilder) UpdatedAtBetween(start, end time.Time, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) UpdatedAtGreaterThan(updatedAt time.Time, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) UpdatedAtGreaterThanOrEqual(updatedAt time.Time, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) UpdatedAtLessThan(updatedAt time.Time, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) UpdatedAtLessThanOrEqual(updatedAt time.Time, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) UpdatedAtNotBetween(start, end time.Time, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) UpdatedByEquals(updatedBy string, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) UpdatedByEqualsAll(builder func(SelectQuery), alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) UpdatedByEqualsAny(builder func(SelectQuery), alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) UpdatedByEqualsCurrent(alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) UpdatedByEqualsSubQuery(builder func(SelectQuery), alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) UpdatedByIn(updatedBys []string, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) UpdatedByInSubQuery(builder func(SelectQuery), alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) UpdatedByNotEquals(updatedBy string, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) UpdatedByNotEqualsAll(builder func(SelectQuery), alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) UpdatedByNotEqualsAny(builder func(SelectQuery), alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) UpdatedByNotEqualsCurrent(alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) UpdatedByNotEqualsSubQuery(builder func(SelectQuery), alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) UpdatedByNotIn(updatedBys []string, alias ...string) ConditionBuilder
- func (cb *CriteriaBuilder) UpdatedByNotInSubQuery(builder func(SelectQuery), alias ...string) ConditionBuilder
- type CumeDistBuilder
- type DB
- type DBAccessor
- type DateTimeUnit
- type DeleteQuery
- type DenseRankBuilder
- type DialectAction
- type DialectActionErr
- type DialectExecs
- type DialectExecsWithErr
- type DialectExprBuilder
- type DialectExprs
- type DialectFragmentBuilder
- type DialectFragments
- type DistinctableAggregate
- type ExprBuilder
- type Expressions
- type Filterable
- type FirstValueBuilder
- type FrameBoundKind
- type FrameType
- type FromDirection
- type FuzzyKind
- type IDHandler
- type IDModel
- type InsertColumnHandler
- type InsertQuery
- type InsertQueryConflictBuilder
- func (b *InsertQueryConflictBuilder) Columns(columns ...string) ConflictBuilder
- func (b *InsertQueryConflictBuilder) Constraint(name string) ConflictBuilder
- func (b *InsertQueryConflictBuilder) DoNothing()
- func (b *InsertQueryConflictBuilder) DoUpdate() ConflictUpdateBuilder
- func (b *InsertQueryConflictBuilder) Where(builder func(ConditionBuilder)) ConflictBuilder
- type InsertQueryConflictUpdateBuilder
- func (b *InsertQueryConflictUpdateBuilder) Set(column string, value ...any) ConflictUpdateBuilder
- func (b *InsertQueryConflictUpdateBuilder) SetExpr(column string, builder func(ExprBuilder) any) ConflictUpdateBuilder
- func (b *InsertQueryConflictUpdateBuilder) Where(builder func(ConditionBuilder)) ConflictUpdateBuilder
- type JSONArrayAggBuilder
- type JSONObjectAggBuilder
- type JoinOperations
- type JoinType
- type LagBuilder
- type LastValueBuilder
- type LeadBuilder
- type Limitable
- type MaxBuilder
- type MergeInsertBuilder
- type MergeQuery
- type MergeUpdateBuilder
- type MergeWhenBuilder
- type MinBuilder
- type Model
- type NTileBuilder
- type NthValueBuilder
- type NullHandlingBuilder
- type NullsMode
- type OrderBuilder
- type Orderable
- type OrderableAggregate
- type PKConditionBuilder
- type PKField
- type PercentRankBuilder
- type QueryBuilder
- type QueryConditionBuilder
- type QueryExecutor
- type QueryExprBuilder
- func (b *QueryExprBuilder) Abs(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) Acos(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) Add(left, right any) schema.QueryAppender
- func (b *QueryExprBuilder) Age(start, end any) schema.QueryAppender
- func (b *QueryExprBuilder) All(builder func(SelectQuery)) schema.QueryAppender
- func (b *QueryExprBuilder) AllColumns(tableAlias ...string) schema.QueryAppender
- func (b *QueryExprBuilder) Any(builder func(SelectQuery)) schema.QueryAppender
- func (b *QueryExprBuilder) ArrayAgg(builder func(ArrayAggBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) Asin(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) Atan(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) Avg(builder func(AvgBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) AvgColumn(column string, distinct ...bool) schema.QueryAppender
- func (b *QueryExprBuilder) Between(expr, lower, upper any) schema.QueryAppender
- func (b *QueryExprBuilder) BitAnd(builder func(BitAndBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) BitOr(builder func(BitOrBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) BoolAnd(builder func(BoolAndBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) BoolOr(builder func(BoolOrBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) Case(builder func(CaseBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) Ceil(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) CharLength(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) Coalesce(args ...any) schema.QueryAppender
- func (b *QueryExprBuilder) Column(column string, withTableAlias ...bool) schema.QueryAppender
- func (b *QueryExprBuilder) Concat(args ...any) schema.QueryAppender
- func (b *QueryExprBuilder) ConcatWithSep(separator any, args ...any) schema.QueryAppender
- func (b *QueryExprBuilder) Contains(expr, substr any) schema.QueryAppender
- func (b *QueryExprBuilder) ContainsIgnoreCase(expr, substr any) schema.QueryAppender
- func (b *QueryExprBuilder) Cos(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) Count(builder func(CountBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) CountAll(distinct ...bool) schema.QueryAppender
- func (b *QueryExprBuilder) CountColumn(column string, distinct ...bool) schema.QueryAppender
- func (b *QueryExprBuilder) CumeDist(builder func(CumeDistBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) CurrentDate() schema.QueryAppender
- func (b *QueryExprBuilder) CurrentTime() schema.QueryAppender
- func (b *QueryExprBuilder) CurrentTimestamp() schema.QueryAppender
- func (b *QueryExprBuilder) DateAdd(expr, interval any, unit DateTimeUnit) schema.QueryAppender
- func (b *QueryExprBuilder) DateDiff(start, end any, unit DateTimeUnit) schema.QueryAppender
- func (b *QueryExprBuilder) DateSubtract(expr, interval any, unit DateTimeUnit) schema.QueryAppender
- func (b *QueryExprBuilder) DateTrunc(unit DateTimeUnit, expr any) schema.QueryAppender
- func (b *QueryExprBuilder) Decode(args ...any) schema.QueryAppender
- func (b *QueryExprBuilder) DenseRank(builder func(DenseRankBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) Divide(left, right any) schema.QueryAppender
- func (b *QueryExprBuilder) EndsWith(expr, suffix any) schema.QueryAppender
- func (b *QueryExprBuilder) EndsWithIgnoreCase(expr, suffix any) schema.QueryAppender
- func (b *QueryExprBuilder) Equals(left, right any) schema.QueryAppender
- func (b *QueryExprBuilder) ExecByDialect(execs DialectExecs)
- func (b *QueryExprBuilder) ExecByDialectWithErr(execs DialectExecsWithErr) error
- func (b *QueryExprBuilder) Exists(builder func(SelectQuery)) schema.QueryAppender
- func (b *QueryExprBuilder) Exp(expr any) schema.QueryAppender
- func (*QueryExprBuilder) Expr(expr string, args ...any) schema.QueryAppender
- func (b *QueryExprBuilder) ExprByDialect(exprs DialectExprs) schema.QueryAppender
- func (*QueryExprBuilder) Exprs(exprs ...any) schema.QueryAppender
- func (*QueryExprBuilder) ExprsWithSep(sep any, exprs ...any) schema.QueryAppender
- func (b *QueryExprBuilder) ExtractDay(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) ExtractHour(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) ExtractMinute(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) ExtractMonth(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) ExtractSecond(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) ExtractYear(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) FirstValue(builder func(FirstValueBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) Floor(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) FragmentByDialect(fragments DialectFragments) ([]byte, error)
- func (b *QueryExprBuilder) GreaterThan(left, right any) schema.QueryAppender
- func (b *QueryExprBuilder) GreaterThanOrEqual(left, right any) schema.QueryAppender
- func (b *QueryExprBuilder) Greatest(args ...any) schema.QueryAppender
- func (b *QueryExprBuilder) IfNull(expr, defaultValue any) schema.QueryAppender
- func (b *QueryExprBuilder) In(expr any, values ...any) schema.QueryAppender
- func (b *QueryExprBuilder) IsFalse(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) IsNotNull(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) IsNull(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) IsTrue(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) JSONArray(args ...any) schema.QueryAppender
- func (b *QueryExprBuilder) JSONArrayAgg(builder func(JSONArrayAggBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) JSONArrayAppend(json, path, value any) schema.QueryAppender
- func (b *QueryExprBuilder) JSONContains(json, value any) schema.QueryAppender
- func (b *QueryExprBuilder) JSONContainsPath(json, path any) schema.QueryAppender
- func (b *QueryExprBuilder) JSONExtract(json, path any) schema.QueryAppender
- func (b *QueryExprBuilder) JSONInsert(json, path, value any) schema.QueryAppender
- func (b *QueryExprBuilder) JSONKeys(json any, path ...any) schema.QueryAppender
- func (b *QueryExprBuilder) JSONLength(json any, path ...any) schema.QueryAppender
- func (b *QueryExprBuilder) JSONObject(keyValues ...any) schema.QueryAppender
- func (b *QueryExprBuilder) JSONObjectAgg(builder func(JSONObjectAggBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) JSONReplace(json, path, value any) schema.QueryAppender
- func (b *QueryExprBuilder) JSONSet(json, path, value any) schema.QueryAppender
- func (b *QueryExprBuilder) JSONType(json any, path ...any) schema.QueryAppender
- func (b *QueryExprBuilder) JSONUnquote(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) JSONValid(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) Lag(builder func(LagBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) LastValue(builder func(LastValueBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) Lead(builder func(LeadBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) Least(args ...any) schema.QueryAppender
- func (b *QueryExprBuilder) Left(expr, length any) schema.QueryAppender
- func (b *QueryExprBuilder) Length(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) LessThan(left, right any) schema.QueryAppender
- func (b *QueryExprBuilder) LessThanOrEqual(left, right any) schema.QueryAppender
- func (b *QueryExprBuilder) Literal(value any) schema.QueryAppender
- func (b *QueryExprBuilder) Ln(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) Log(expr any, base ...any) schema.QueryAppender
- func (b *QueryExprBuilder) Lower(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) Max(builder func(MaxBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) MaxColumn(column string) schema.QueryAppender
- func (b *QueryExprBuilder) Min(builder func(MinBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) MinColumn(column string) schema.QueryAppender
- func (b *QueryExprBuilder) Mod(dividend, divisor any) schema.QueryAppender
- func (b *QueryExprBuilder) Multiply(left, right any) schema.QueryAppender
- func (b *QueryExprBuilder) NTile(builder func(NTileBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) Not(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) NotBetween(expr, lower, upper any) schema.QueryAppender
- func (b *QueryExprBuilder) NotEquals(left, right any) schema.QueryAppender
- func (b *QueryExprBuilder) NotExists(builder func(SelectQuery)) schema.QueryAppender
- func (b *QueryExprBuilder) NotIn(expr any, values ...any) schema.QueryAppender
- func (b *QueryExprBuilder) Now() schema.QueryAppender
- func (b *QueryExprBuilder) NthValue(builder func(NthValueBuilder)) schema.QueryAppender
- func (*QueryExprBuilder) Null() schema.QueryAppender
- func (b *QueryExprBuilder) NullIf(expr1, expr2 any) schema.QueryAppender
- func (b *QueryExprBuilder) Order(builder func(OrderBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) Paren(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) PercentRank(builder func(PercentRankBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) Pi() schema.QueryAppender
- func (b *QueryExprBuilder) Position(substring, str any) schema.QueryAppender
- func (b *QueryExprBuilder) Power(base, exponent any) schema.QueryAppender
- func (b *QueryExprBuilder) Random() schema.QueryAppender
- func (b *QueryExprBuilder) Rank(builder func(RankBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) Repeat(expr, count any) schema.QueryAppender
- func (b *QueryExprBuilder) Replace(expr, search, replacement any) schema.QueryAppender
- func (b *QueryExprBuilder) Reverse(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) Right(expr, length any) schema.QueryAppender
- func (b *QueryExprBuilder) Round(expr any, precision ...any) schema.QueryAppender
- func (b *QueryExprBuilder) RowNumber(builder func(RowNumberBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) Sign(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) Sin(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) Sqrt(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) StartsWith(expr, prefix any) schema.QueryAppender
- func (b *QueryExprBuilder) StartsWithIgnoreCase(expr, prefix any) schema.QueryAppender
- func (b *QueryExprBuilder) StdDev(builder func(StdDevBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) StringAgg(builder func(StringAggBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) SubQuery(builder func(SelectQuery)) schema.QueryAppender
- func (b *QueryExprBuilder) SubString(expr, start any, length ...any) schema.QueryAppender
- func (b *QueryExprBuilder) Subtract(left, right any) schema.QueryAppender
- func (b *QueryExprBuilder) Sum(builder func(SumBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) SumColumn(column string, distinct ...bool) schema.QueryAppender
- func (b *QueryExprBuilder) TableColumns(withTableAlias ...bool) schema.QueryAppender
- func (b *QueryExprBuilder) Tan(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) ToBool(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) ToDate(expr any, format ...any) schema.QueryAppender
- func (b *QueryExprBuilder) ToDecimal(expr any, precision ...any) schema.QueryAppender
- func (b *QueryExprBuilder) ToFloat(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) ToInteger(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) ToJSON(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) ToString(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) ToTime(expr any, format ...any) schema.QueryAppender
- func (b *QueryExprBuilder) ToTimestamp(expr any, format ...any) schema.QueryAppender
- func (b *QueryExprBuilder) Trim(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) TrimLeft(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) TrimRight(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) Trunc(expr any, precision ...any) schema.QueryAppender
- func (b *QueryExprBuilder) Upper(expr any) schema.QueryAppender
- func (b *QueryExprBuilder) Variance(builder func(VarianceBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) WinArrayAgg(builder func(WindowArrayAggBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) WinAvg(builder func(WindowAvgBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) WinBitAnd(builder func(WindowBitAndBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) WinBitOr(builder func(WindowBitOrBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) WinBoolAnd(builder func(WindowBoolAndBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) WinBoolOr(builder func(WindowBoolOrBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) WinCount(builder func(WindowCountBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) WinJSONArrayAgg(builder func(WindowJSONArrayAggBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) WinJSONObjectAgg(builder func(WindowJSONObjectAggBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) WinMax(builder func(WindowMaxBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) WinMin(builder func(WindowMinBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) WinStdDev(builder func(WindowStdDevBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) WinStringAgg(builder func(WindowStringAggBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) WinSum(builder func(WindowSumBuilder)) schema.QueryAppender
- func (b *QueryExprBuilder) WinVariance(builder func(WindowVarianceBuilder)) schema.QueryAppender
- type RankBuilder
- type RawQuery
- type RelationSpec
- type Returnable
- type RowNumberBuilder
- type SelectQuery
- type SelectQueryExecutor
- type Selectable
- type StatisticalAggregate
- type StatisticalMode
- type StdDevBuilder
- type StringAggBuilder
- type SumBuilder
- type TableSource
- type Unwrapper
- type UpdateColumnHandler
- type UpdateQuery
- type UpdatedAtHandler
- type UpdatedByHandler
- type VarianceBuilder
- type WindowArrayAggBuilder
- type WindowAvgBuilder
- type WindowBitAndBuilder
- type WindowBitOrBuilder
- type WindowBoolAndBuilder
- type WindowBoolOrBuilder
- type WindowBoundable
- type WindowCountBuilder
- type WindowEndBoundable
- type WindowFrameBuilder
- type WindowFrameEndBuilder
- type WindowFrameablePartitionBuilder
- type WindowJSONArrayAggBuilder
- type WindowJSONObjectAggBuilder
- type WindowMaxBuilder
- type WindowMinBuilder
- type WindowPartitionBuilder
- type WindowPartitionable
- type WindowStartBoundable
- type WindowStdDevBuilder
- type WindowStringAggBuilder
- type WindowSumBuilder
- type WindowVarianceBuilder
Constants ¶
This section is empty.
Variables ¶
var ( ErrSubQuery = errors.New("cannot execute a subquery directly; use it as part of a parent query") ErrAggregateMissingArgs = errors.New("aggregate function requires at least one argument") ErrDialectUnsupportedOperation = errors.New("operation not supported by current database dialect") ErrAggregateUnsupportedFunction = errors.New("aggregate function not supported by current database dialect") ErrDialectHandlerMissing = errors.New("no dialect handler available for requested operation") ErrMissingColumnOrExpression = errors.New("order clause requires at least one column or expression") ErrModelMustBePointerToStruct = errors.New("model must be a pointer to struct") ErrPrimaryKeyUnsupportedType = errors.New("unsupported primary key type") )
Module provides the Orm functionality for the VEF framework. It registers the database provider and logs initialization status.
Functions ¶
func ApplySort ¶ added in v0.7.0
func ApplySort(query SelectQuery, orders []sortx.OrderSpec)
ApplySort applies the sort orders to the query.
func Names ¶
func Names(ns ...string) schema.QueryAppender
Names returns a query appender that appends a list of names to the query.
Types ¶
type Applier ¶
type Applier[T any] interface { // Apply applies shared operations. Apply(fns ...ApplyFunc[T]) T // ApplyIf applies shared operations if the condition is true. ApplyIf(condition bool, fns ...ApplyFunc[T]) T }
Applier is an interface that defines the methods for applying shared operations to queries. It enables reusable query modifications and conditional application of operations.
type ApplyFunc ¶
type ApplyFunc[T any] func(T)
ApplyFunc is a function type that applies a shared operation to a query. It enables reusable query modifications that can be applied to different query types.
type ArrayAggBuilder ¶
type ArrayAggBuilder interface {
BaseAggregate[ArrayAggBuilder]
DistinctableAggregate[ArrayAggBuilder]
OrderableAggregate[ArrayAggBuilder]
NullHandlingBuilder[ArrayAggBuilder]
}
ArrayAggBuilder defines the ARRAY_AGG aggregate function builder.
type AuditConditionBuilder ¶
type AuditConditionBuilder interface {
// CreatedByEquals is a condition that checks if the created by column is equal to a value.
CreatedByEquals(createdBy string, alias ...string) ConditionBuilder
// OrCreatedByEquals is an OR condition that checks if the created by column is equal to a value.
OrCreatedByEquals(createdBy string, alias ...string) ConditionBuilder
// CreatedByEqualsSubQuery is a condition that checks if the created by column is equal to a subquery.
CreatedByEqualsSubQuery(builder func(query SelectQuery), alias ...string) ConditionBuilder
// OrCreatedByEqualsSubQuery is a condition that checks if the created by column is equal to a subquery.
OrCreatedByEqualsSubQuery(builder func(query SelectQuery), alias ...string) ConditionBuilder
// CreatedByEqualsAny is a condition that checks if the created by column is equal to any value returned by a subquery.
CreatedByEqualsAny(builder func(query SelectQuery), alias ...string) ConditionBuilder
// OrCreatedByEqualsAny is a condition that checks if the created by column is equal to any value returned by a subquery.
OrCreatedByEqualsAny(builder func(query SelectQuery), alias ...string) ConditionBuilder
// CreatedByEqualsAll is a condition that checks if the created by column is equal to all values returned by a subquery.
CreatedByEqualsAll(builder func(query SelectQuery), alias ...string) ConditionBuilder
// OrCreatedByEqualsAll is a condition that checks if the created by column is equal to all values returned by a subquery.
OrCreatedByEqualsAll(builder func(query SelectQuery), alias ...string) ConditionBuilder
// CreatedByEqualsCurrent is a condition that checks if the created by column is equal to the current user.
CreatedByEqualsCurrent(alias ...string) ConditionBuilder
// OrCreatedByEqualsCurrent is a condition that checks if the created by column is equal to the current user.
OrCreatedByEqualsCurrent(alias ...string) ConditionBuilder
// CreatedByNotEquals is a condition that checks if the created by column is not equal to a value.
CreatedByNotEquals(createdBy string, alias ...string) ConditionBuilder
// OrCreatedByNotEquals is a condition that checks if the created by column is not equal to a value.
OrCreatedByNotEquals(createdBy string, alias ...string) ConditionBuilder
// CreatedByNotEqualsSubQuery is a condition that checks if the created by column is not equal to a subquery.
CreatedByNotEqualsSubQuery(builder func(query SelectQuery), alias ...string) ConditionBuilder
// OrCreatedByNotEqualsSubQuery is a condition that checks if the created by column is not equal to a subquery.
OrCreatedByNotEqualsSubQuery(builder func(query SelectQuery), alias ...string) ConditionBuilder
// CreatedByNotEqualsAny is a condition that checks if the created by column is not equal to any value returned by a subquery.
CreatedByNotEqualsAny(builder func(query SelectQuery), alias ...string) ConditionBuilder
// OrCreatedByNotEqualsAny is a condition that checks if the created by column is not equal to any value returned by a subquery.
OrCreatedByNotEqualsAny(builder func(query SelectQuery), alias ...string) ConditionBuilder
// CreatedByNotEqualsAll is a condition that checks if the created by column is not equal to all values returned by a subquery.
CreatedByNotEqualsAll(builder func(query SelectQuery), alias ...string) ConditionBuilder
// OrCreatedByNotEqualsAll is a condition that checks if the created by column is not equal to all values returned by a subquery.
OrCreatedByNotEqualsAll(builder func(query SelectQuery), alias ...string) ConditionBuilder
// CreatedByNotEqualsCurrent is a condition that checks if the created by column is not equal to the current user.
CreatedByNotEqualsCurrent(alias ...string) ConditionBuilder
// OrCreatedByNotEqualsCurrent is a condition that checks if the created by column is not equal to the current user.
OrCreatedByNotEqualsCurrent(alias ...string) ConditionBuilder
// CreatedByIn is a condition that checks if the created by column is in a list of values.
CreatedByIn(createdBys []string, alias ...string) ConditionBuilder
// OrCreatedByIn is a condition that checks if the created by column is in a list of values.
OrCreatedByIn(createdBys []string, alias ...string) ConditionBuilder
// CreatedByInSubQuery is a condition that checks if the created by column is in a subquery.
CreatedByInSubQuery(builder func(query SelectQuery), alias ...string) ConditionBuilder
// CreatedByNotIn is a condition that checks if the created by column is not in a list of values.
CreatedByNotIn(createdBys []string, alias ...string) ConditionBuilder
// OrCreatedByNotIn is a condition that checks if the created by column is not in a list of values.
OrCreatedByNotIn(createdBys []string, alias ...string) ConditionBuilder
// CreatedByNotInSubQuery is a condition that checks if the created by column is not in a subquery.
CreatedByNotInSubQuery(builder func(query SelectQuery), alias ...string) ConditionBuilder
// OrCreatedByNotInSubQuery is a condition that checks if the created by column is not in a subquery.
OrCreatedByNotInSubQuery(builder func(query SelectQuery), alias ...string) ConditionBuilder
// UpdatedByEquals is a condition that checks if the updated by column is equal to a value.
UpdatedByEquals(updatedBy string, alias ...string) ConditionBuilder
// OrUpdatedByEquals is a condition that checks if the updated by column is equal to a value.
OrUpdatedByEquals(updatedBy string, alias ...string) ConditionBuilder
// UpdatedByEqualsSubQuery is a condition that checks if the updated by column is equal to a subquery.
UpdatedByEqualsSubQuery(builder func(query SelectQuery), alias ...string) ConditionBuilder
// OrUpdatedByEqualsSubQuery is a condition that checks if the updated by column is equal to a subquery.
OrUpdatedByEqualsSubQuery(builder func(query SelectQuery), alias ...string) ConditionBuilder
// UpdatedByEqualsAny is a condition that checks if the updated by column is equal to any value returned by a subquery.
UpdatedByEqualsAny(builder func(query SelectQuery), alias ...string) ConditionBuilder
// OrUpdatedByEqualsAny is a condition that checks if the updated by column is equal to any value returned by a subquery.
OrUpdatedByEqualsAny(builder func(query SelectQuery), alias ...string) ConditionBuilder
// UpdatedByEqualsAll is a condition that checks if the updated by column is equal to all values returned by a subquery.
UpdatedByEqualsAll(builder func(query SelectQuery), alias ...string) ConditionBuilder
// OrUpdatedByEqualsAll is a condition that checks if the updated by column is equal to all values returned by a subquery.
OrUpdatedByEqualsAll(builder func(query SelectQuery), alias ...string) ConditionBuilder
// UpdatedByEqualsCurrent is a condition that checks if the updated by column is equal to the current user.
UpdatedByEqualsCurrent(alias ...string) ConditionBuilder
// OrUpdatedByEqualsCurrent is a condition that checks if the updated by column is equal to the current user.
OrUpdatedByEqualsCurrent(alias ...string) ConditionBuilder
// UpdatedByNotEquals is a condition that checks if the updated by column is not equal to a value.
UpdatedByNotEquals(updatedBy string, alias ...string) ConditionBuilder
// UpdatedByNotEqualsSubQuery is a condition that checks if the updated by column is not equal to a subquery.
UpdatedByNotEqualsSubQuery(builder func(query SelectQuery), alias ...string) ConditionBuilder
// OrUpdatedByNotEqualsSubQuery is a condition that checks if the updated by column is not equal to a subquery.
OrUpdatedByNotEqualsSubQuery(builder func(query SelectQuery), alias ...string) ConditionBuilder
// UpdatedByNotEqualsAny is a condition that checks if the updated by column is not equal to any value returned by a subquery.
UpdatedByNotEqualsAny(builder func(query SelectQuery), alias ...string) ConditionBuilder
// OrUpdatedByNotEqualsAny is a condition that checks if the updated by column is not equal to any value returned by a subquery.
OrUpdatedByNotEqualsAny(builder func(query SelectQuery), alias ...string) ConditionBuilder
// UpdatedByNotEqualsAll is a condition that checks if the updated by column is not equal to all values returned by a subquery.
UpdatedByNotEqualsAll(builder func(query SelectQuery), alias ...string) ConditionBuilder
// OrUpdatedByNotEqualsAll is a condition that checks if the updated by column is not equal to all values returned by a subquery.
OrUpdatedByNotEqualsAll(builder func(query SelectQuery), alias ...string) ConditionBuilder
// UpdatedByNotEqualsCurrent is a condition that checks if the updated by column is not equal to the current user.
UpdatedByNotEqualsCurrent(alias ...string) ConditionBuilder
// OrUpdatedByNotEqualsCurrent is a condition that checks if the updated by column is not equal to the current user.
OrUpdatedByNotEqualsCurrent(alias ...string) ConditionBuilder
// UpdatedByIn is a condition that checks if the updated by column is in a list of values.
UpdatedByIn(updatedBys []string, alias ...string) ConditionBuilder
// UpdatedByInSubQuery is a condition that checks if the updated by column is in a subquery.
UpdatedByInSubQuery(builder func(query SelectQuery), alias ...string) ConditionBuilder
// OrUpdatedByInSubQuery is a condition that checks if the updated by column is in a subquery.
OrUpdatedByInSubQuery(builder func(query SelectQuery), alias ...string) ConditionBuilder
// UpdatedByNotIn is a condition that checks if the updated by column is not in a list of values.
UpdatedByNotIn(updatedBys []string, alias ...string) ConditionBuilder
// OrUpdatedByNotIn is a condition that checks if the updated by column is not in a list of values.
OrUpdatedByNotIn(updatedBys []string, alias ...string) ConditionBuilder
// UpdatedByNotInSubQuery is a condition that checks if the updated by column is not in a subquery.
UpdatedByNotInSubQuery(builder func(query SelectQuery), alias ...string) ConditionBuilder
// OrUpdatedByNotInSubQuery is a condition that checks if the updated by column is not in a subquery.
OrUpdatedByNotInSubQuery(builder func(query SelectQuery), alias ...string) ConditionBuilder
// CreatedAtGreaterThan is a condition that checks if the created at column is greater than a value.
CreatedAtGreaterThan(createdAt time.Time, alias ...string) ConditionBuilder
// OrCreatedAtGreaterThan is a condition that checks if the created at column is greater than a value.
OrCreatedAtGreaterThan(createdAt time.Time, alias ...string) ConditionBuilder
// CreatedAtGreaterThanOrEqual is a condition that checks if the created at column is greater than or equal to a value.
CreatedAtGreaterThanOrEqual(createdAt time.Time, alias ...string) ConditionBuilder
// OrCreatedAtGreaterThanOrEqual is a condition that checks if the created at column is greater than or equal to a value.
OrCreatedAtGreaterThanOrEqual(createdAt time.Time, alias ...string) ConditionBuilder
// CreatedAtLessThan is a condition that checks if the created at column is less than a value.
CreatedAtLessThan(createdAt time.Time, alias ...string) ConditionBuilder
// OrCreatedAtLessThan is a condition that checks if the created at column is less than a value.
OrCreatedAtLessThan(createdAt time.Time, alias ...string) ConditionBuilder
// CreatedAtLessThanOrEqual is a condition that checks if the created at column is less than or equal to a value.
CreatedAtLessThanOrEqual(createdAt time.Time, alias ...string) ConditionBuilder
// OrCreatedAtLessThanOrEqual is a condition that checks if the created at column is less than or equal to a value.
OrCreatedAtLessThanOrEqual(createdAt time.Time, alias ...string) ConditionBuilder
// CreatedAtBetween is a condition that checks if the created at column is between two values.
CreatedAtBetween(start, end time.Time, alias ...string) ConditionBuilder
// OrCreatedAtBetween is a condition that checks if the created at column is between two values.
OrCreatedAtBetween(start, end time.Time, alias ...string) ConditionBuilder
// CreatedAtNotBetween is a condition that checks if the created at column is not between two values.
CreatedAtNotBetween(start, end time.Time, alias ...string) ConditionBuilder
// OrCreatedAtNotBetween is a condition that checks if the created at column is not between two values.
OrCreatedAtNotBetween(start, end time.Time, alias ...string) ConditionBuilder
// UpdatedAtGreaterThan is a condition that checks if the updated at column is greater than a value.
UpdatedAtGreaterThan(updatedAt time.Time, alias ...string) ConditionBuilder
// OrUpdatedAtGreaterThan is a condition that checks if the updated at column is greater than a value.
OrUpdatedAtGreaterThan(updatedAt time.Time, alias ...string) ConditionBuilder
// UpdatedAtGreaterThanOrEqual is a condition that checks if the updated at column is greater than or equal to a value.
UpdatedAtGreaterThanOrEqual(updatedAt time.Time, alias ...string) ConditionBuilder
// OrUpdatedAtGreaterThanOrEqual is a condition that checks if the updated at column is greater than or equal to a value.
OrUpdatedAtGreaterThanOrEqual(updatedAt time.Time, alias ...string) ConditionBuilder
// UpdatedAtLessThan is a condition that checks if the updated at column is less than a value.
UpdatedAtLessThan(updatedAt time.Time, alias ...string) ConditionBuilder
// OrUpdatedAtLessThan is a condition that checks if the updated at column is less than a value.
OrUpdatedAtLessThan(updatedAt time.Time, alias ...string) ConditionBuilder
// UpdatedAtLessThanOrEqual is a condition that checks if the updated at column is less than or equal to a value.
UpdatedAtLessThanOrEqual(updatedAt time.Time, alias ...string) ConditionBuilder
// OrUpdatedAtLessThanOrEqual is a condition that checks if the updated at column is less than or equal to a value.
OrUpdatedAtLessThanOrEqual(updatedAt time.Time, alias ...string) ConditionBuilder
// UpdatedAtBetween is a condition that checks if the updated at column is between two values.
UpdatedAtBetween(start, end time.Time, alias ...string) ConditionBuilder
// OrUpdatedAtBetween is a condition that checks if the updated at column is between two values.
OrUpdatedAtBetween(start, end time.Time, alias ...string) ConditionBuilder
// UpdatedAtNotBetween is a condition that checks if the updated at column is not between two values.
UpdatedAtNotBetween(start, end time.Time, alias ...string) ConditionBuilder
// OrUpdatedAtNotBetween is a condition that checks if the updated at column is not between two values.
OrUpdatedAtNotBetween(start, end time.Time, alias ...string) ConditionBuilder
}
AuditConditionBuilder is a builder for audit conditions.
type AuditedModel ¶ added in v0.18.0
type AuditedModel struct {
// CreatedAt is the created at time of the model
CreatedAt datetime.DateTime `json:"createdAt" bun:",notnull,type:timestamp,default:CURRENT_TIMESTAMP,skipupdate"`
// CreatedBy is the created by of the model
CreatedBy string `json:"createdBy" bun:",notnull,skipupdate" mold:"translate=user?"`
// CreatedByName is the created by name of the model
CreatedByName string `json:"createdByName" bun:",scanonly"`
// UpdatedAt is the updated at time of the model
UpdatedAt datetime.DateTime `json:"updatedAt" bun:",notnull,type:timestamp,default:CURRENT_TIMESTAMP"`
// UpdatedBy is the updated by of the model
UpdatedBy string `json:"updatedBy" bun:",notnull" mold:"translate=user?"`
// UpdatedByName is the updated by name of the model
UpdatedByName string `json:"updatedByName" bun:",scanonly"`
}
AuditedModel contains full audit tracking fields (create + update).
type AvgBuilder ¶
type AvgBuilder interface {
BaseAggregate[AvgBuilder]
DistinctableAggregate[AvgBuilder]
}
AvgBuilder defines the AVG aggregate function builder.
type BaseAggregate ¶
type BaseAggregate[T any] interface { Column(column string) T Expr(expr any) T // Filter applies a FILTER clause to the aggregate expression. Filter(func(ConditionBuilder)) T }
BaseAggregate defines the basic aggregate function interface with generic type support.
type BaseQueryBuilder ¶
type BaseQueryBuilder struct {
// contains filtered or unexported fields
}
BaseQueryBuilder provides a common implementation for QueryBuilder interface. It can be embedded in concrete query types to reduce code duplication.
func (*BaseQueryBuilder) BuildCondition ¶
func (b *BaseQueryBuilder) BuildCondition(builder func(ConditionBuilder)) interface { schema.QueryAppender ConditionBuilder }
BuildCondition creates a condition builder for WHERE clauses.
func (*BaseQueryBuilder) BuildSubQuery ¶
func (b *BaseQueryBuilder) BuildSubQuery(builder func(query SelectQuery)) *bun.SelectQuery
BuildSubQuery constructs a subquery using a builder function.
func (*BaseQueryBuilder) CreateSubQuery ¶
func (b *BaseQueryBuilder) CreateSubQuery(subQuery *bun.SelectQuery) SelectQuery
CreateSubQuery creates a new subquery from the given bun.SelectQuery.
func (*BaseQueryBuilder) Dialect ¶
func (b *BaseQueryBuilder) Dialect() schema.Dialect
Dialect returns the dialect of the current database connection.
func (*BaseQueryBuilder) ExprBuilder ¶
func (b *BaseQueryBuilder) ExprBuilder() ExprBuilder
ExprBuilder returns the expression builder for this query.
func (*BaseQueryBuilder) GetTable ¶
func (b *BaseQueryBuilder) GetTable() *schema.Table
GetTable returns the table information for the current query.
func (*BaseQueryBuilder) Query ¶
func (b *BaseQueryBuilder) Query() bun.Query
Query returns the query of the current query instance.
func (*BaseQueryBuilder) String ¶
func (b *BaseQueryBuilder) String() string
String returns the SQL query string.
type BaseWindowPartitionBuilder ¶
type BaseWindowPartitionBuilder[T any] interface { // PartitionBy adds PARTITION BY columns to the window definition. PartitionBy(columns ...string) T // PartitionByExpr adds a raw PARTITION BY expression to the window definition. PartitionByExpr(expr any) T // OrderBy adds ORDER BY clauses with ascending direction. OrderBy(columns ...string) T // OrderByDesc adds ORDER BY clauses with descending direction. OrderByDesc(columns ...string) T // OrderByExpr adds an ORDER BY clause using a raw expression. OrderByExpr(expr any) T }
BaseWindowPartitionBuilder defines the base window partition builder interface.
type BitAndBuilder ¶
type BitAndBuilder interface {
BaseAggregate[BitAndBuilder]
}
BitAndBuilder defines the BIT_AND aggregate function builder.
type BitOrBuilder ¶
type BitOrBuilder interface {
BaseAggregate[BitOrBuilder]
}
BitOrBuilder defines the BIT_OR aggregate function builder.
type BoolAndBuilder ¶
type BoolAndBuilder interface {
BaseAggregate[BoolAndBuilder]
}
BoolAndBuilder defines the BOOL_AND aggregate function builder.
type BoolOrBuilder ¶
type BoolOrBuilder interface {
BaseAggregate[BoolOrBuilder]
}
BoolOrBuilder defines the BOOL_OR aggregate function builder.
type BunDB ¶ added in v0.18.0
type BunDB struct {
// contains filtered or unexported fields
}
BunDB is a wrapper around the bun.DB type.
func (*BunDB) ModelPKFields ¶ added in v0.18.0
func (*BunDB) NewDelete ¶ added in v0.18.0
func (d *BunDB) NewDelete() DeleteQuery
func (*BunDB) NewInsert ¶ added in v0.18.0
func (d *BunDB) NewInsert() InsertQuery
func (*BunDB) NewMerge ¶ added in v0.18.0
func (d *BunDB) NewMerge() MergeQuery
func (*BunDB) NewSelect ¶ added in v0.18.0
func (d *BunDB) NewSelect() SelectQuery
func (*BunDB) NewUpdate ¶ added in v0.18.0
func (d *BunDB) NewUpdate() UpdateQuery
func (*BunDB) RunInReadOnlyTX ¶ added in v0.18.0
type BunDeleteQuery ¶
type BunDeleteQuery struct {
QueryBuilder
// contains filtered or unexported fields
}
BunDeleteQuery is the concrete implementation of DeleteQuery interface. It wraps bun.DeleteQuery and provides additional functionality for expression building.
func NewDeleteQuery ¶
func NewDeleteQuery(db *BunDB) *BunDeleteQuery
NewDeleteQuery creates a new DeleteQuery instance with the provided database instance. It initializes the query builders and sets up the table schema context for proper query building.
func (*BunDeleteQuery) Apply ¶
func (q *BunDeleteQuery) Apply(fns ...ApplyFunc[DeleteQuery]) DeleteQuery
func (*BunDeleteQuery) ApplyIf ¶
func (q *BunDeleteQuery) ApplyIf(condition bool, fns ...ApplyFunc[DeleteQuery]) DeleteQuery
func (*BunDeleteQuery) DB ¶ added in v0.18.0
func (q *BunDeleteQuery) DB() DB
func (*BunDeleteQuery) ForceDelete ¶
func (q *BunDeleteQuery) ForceDelete() DeleteQuery
func (*BunDeleteQuery) IncludeDeleted ¶
func (q *BunDeleteQuery) IncludeDeleted() DeleteQuery
func (*BunDeleteQuery) Limit ¶
func (q *BunDeleteQuery) Limit(limit int) DeleteQuery
func (*BunDeleteQuery) Model ¶
func (q *BunDeleteQuery) Model(model any) DeleteQuery
func (*BunDeleteQuery) ModelTable ¶
func (q *BunDeleteQuery) ModelTable(name string, alias ...string) DeleteQuery
func (*BunDeleteQuery) OrderBy ¶
func (q *BunDeleteQuery) OrderBy(columns ...string) DeleteQuery
func (*BunDeleteQuery) OrderByDesc ¶
func (q *BunDeleteQuery) OrderByDesc(columns ...string) DeleteQuery
func (*BunDeleteQuery) OrderByExpr ¶
func (q *BunDeleteQuery) OrderByExpr(builder func(ExprBuilder) any) DeleteQuery
func (*BunDeleteQuery) Returning ¶
func (q *BunDeleteQuery) Returning(columns ...string) DeleteQuery
func (*BunDeleteQuery) ReturningAll ¶
func (q *BunDeleteQuery) ReturningAll() DeleteQuery
func (*BunDeleteQuery) ReturningNone ¶
func (q *BunDeleteQuery) ReturningNone() DeleteQuery
func (*BunDeleteQuery) Table ¶
func (q *BunDeleteQuery) Table(name string, alias ...string) DeleteQuery
func (*BunDeleteQuery) TableExpr ¶
func (q *BunDeleteQuery) TableExpr(builder func(ExprBuilder) any, alias ...string) DeleteQuery
func (*BunDeleteQuery) TableFrom ¶ added in v0.7.1
func (q *BunDeleteQuery) TableFrom(model any, alias ...string) DeleteQuery
func (*BunDeleteQuery) TableSubQuery ¶
func (q *BunDeleteQuery) TableSubQuery(builder func(SelectQuery), alias ...string) DeleteQuery
func (*BunDeleteQuery) Unwrap ¶
func (q *BunDeleteQuery) Unwrap() *bun.DeleteQuery
func (*BunDeleteQuery) Where ¶
func (q *BunDeleteQuery) Where(builder func(ConditionBuilder)) DeleteQuery
func (*BunDeleteQuery) WhereDeleted ¶
func (q *BunDeleteQuery) WhereDeleted() DeleteQuery
func (*BunDeleteQuery) WherePK ¶
func (q *BunDeleteQuery) WherePK(columns ...string) DeleteQuery
func (*BunDeleteQuery) With ¶
func (q *BunDeleteQuery) With(name string, builder func(SelectQuery)) DeleteQuery
func (*BunDeleteQuery) WithRecursive ¶
func (q *BunDeleteQuery) WithRecursive(name string, builder func(SelectQuery)) DeleteQuery
func (*BunDeleteQuery) WithValues ¶
func (q *BunDeleteQuery) WithValues(name string, model any, withOrder ...bool) DeleteQuery
type BunInsertQuery ¶
type BunInsertQuery struct {
QueryBuilder
// contains filtered or unexported fields
}
BunInsertQuery is the concrete implementation of InsertQuery interface. It wraps bun.InsertQuery and provides additional functionality for expression building.
func NewInsertQuery ¶
func NewInsertQuery(db *BunDB) *BunInsertQuery
NewInsertQuery creates a new InsertQuery instance with the provided database instance. It initializes the query builders and sets up the table schema context for proper query building.
func (*BunInsertQuery) Apply ¶
func (q *BunInsertQuery) Apply(fns ...ApplyFunc[InsertQuery]) InsertQuery
func (*BunInsertQuery) ApplyIf ¶
func (q *BunInsertQuery) ApplyIf(condition bool, fns ...ApplyFunc[InsertQuery]) InsertQuery
func (*BunInsertQuery) Column ¶
func (q *BunInsertQuery) Column(name string, value any) InsertQuery
func (*BunInsertQuery) ColumnExpr ¶
func (q *BunInsertQuery) ColumnExpr(name string, builder func(ExprBuilder) any) InsertQuery
func (*BunInsertQuery) DB ¶ added in v0.18.0
func (q *BunInsertQuery) DB() DB
func (*BunInsertQuery) Exclude ¶
func (q *BunInsertQuery) Exclude(columns ...string) InsertQuery
func (*BunInsertQuery) ExcludeAll ¶
func (q *BunInsertQuery) ExcludeAll() InsertQuery
func (*BunInsertQuery) Model ¶
func (q *BunInsertQuery) Model(model any) InsertQuery
func (*BunInsertQuery) ModelTable ¶
func (q *BunInsertQuery) ModelTable(name string, alias ...string) InsertQuery
func (*BunInsertQuery) OnConflict ¶
func (q *BunInsertQuery) OnConflict(builder func(ConflictBuilder)) InsertQuery
OnConflict configures conflict handling via a dialect-aware builder.
func (*BunInsertQuery) Returning ¶
func (q *BunInsertQuery) Returning(columns ...string) InsertQuery
func (*BunInsertQuery) ReturningAll ¶
func (q *BunInsertQuery) ReturningAll() InsertQuery
func (*BunInsertQuery) ReturningNone ¶
func (q *BunInsertQuery) ReturningNone() InsertQuery
func (*BunInsertQuery) Select ¶
func (q *BunInsertQuery) Select(columns ...string) InsertQuery
func (*BunInsertQuery) SelectAll ¶
func (q *BunInsertQuery) SelectAll() InsertQuery
func (*BunInsertQuery) Table ¶
func (q *BunInsertQuery) Table(name string, alias ...string) InsertQuery
func (*BunInsertQuery) TableExpr ¶
func (q *BunInsertQuery) TableExpr(builder func(ExprBuilder) any, alias ...string) InsertQuery
func (*BunInsertQuery) TableFrom ¶ added in v0.7.1
func (q *BunInsertQuery) TableFrom(model any, alias ...string) InsertQuery
func (*BunInsertQuery) TableSubQuery ¶
func (q *BunInsertQuery) TableSubQuery(builder func(SelectQuery), alias ...string) InsertQuery
func (*BunInsertQuery) Unwrap ¶
func (q *BunInsertQuery) Unwrap() *bun.InsertQuery
func (*BunInsertQuery) With ¶
func (q *BunInsertQuery) With(name string, builder func(SelectQuery)) InsertQuery
func (*BunInsertQuery) WithRecursive ¶
func (q *BunInsertQuery) WithRecursive(name string, builder func(SelectQuery)) InsertQuery
func (*BunInsertQuery) WithValues ¶
func (q *BunInsertQuery) WithValues(name string, model any, withOrder ...bool) InsertQuery
type BunMergeQuery ¶
type BunMergeQuery struct {
QueryBuilder
// contains filtered or unexported fields
}
BunMergeQuery is the concrete implementation of MergeQuery interface. It wraps bun.MergeQuery and provides additional functionality for expression building.
func NewMergeQuery ¶
func NewMergeQuery(db *BunDB) *BunMergeQuery
NewMergeQuery creates a new MergeQuery instance with the provided database instance. It initializes the query builders and sets up the table schema context for proper query building.
func (*BunMergeQuery) Apply ¶
func (q *BunMergeQuery) Apply(fns ...ApplyFunc[MergeQuery]) MergeQuery
func (*BunMergeQuery) ApplyIf ¶
func (q *BunMergeQuery) ApplyIf(condition bool, fns ...ApplyFunc[MergeQuery]) MergeQuery
func (*BunMergeQuery) DB ¶ added in v0.18.0
func (q *BunMergeQuery) DB() DB
func (*BunMergeQuery) Model ¶
func (q *BunMergeQuery) Model(model any) MergeQuery
func (*BunMergeQuery) ModelTable ¶
func (q *BunMergeQuery) ModelTable(name string, alias ...string) MergeQuery
func (*BunMergeQuery) On ¶
func (q *BunMergeQuery) On(builder func(ConditionBuilder)) MergeQuery
func (*BunMergeQuery) Returning ¶
func (q *BunMergeQuery) Returning(columns ...string) MergeQuery
func (*BunMergeQuery) ReturningAll ¶
func (q *BunMergeQuery) ReturningAll() MergeQuery
func (*BunMergeQuery) ReturningNone ¶
func (q *BunMergeQuery) ReturningNone() MergeQuery
func (*BunMergeQuery) Table ¶
func (q *BunMergeQuery) Table(name string, alias ...string) MergeQuery
func (*BunMergeQuery) TableExpr ¶
func (q *BunMergeQuery) TableExpr(builder func(ExprBuilder) any, alias ...string) MergeQuery
func (*BunMergeQuery) TableFrom ¶ added in v0.7.1
func (q *BunMergeQuery) TableFrom(model any, alias ...string) MergeQuery
func (*BunMergeQuery) TableSubQuery ¶
func (q *BunMergeQuery) TableSubQuery(builder func(SelectQuery), alias ...string) MergeQuery
func (*BunMergeQuery) Unwrap ¶
func (q *BunMergeQuery) Unwrap() *bun.MergeQuery
func (*BunMergeQuery) Using ¶
func (q *BunMergeQuery) Using(model any, alias ...string) MergeQuery
func (*BunMergeQuery) UsingExpr ¶
func (q *BunMergeQuery) UsingExpr(builder func(ExprBuilder) any, alias ...string) MergeQuery
func (*BunMergeQuery) UsingSubQuery ¶
func (q *BunMergeQuery) UsingSubQuery(builder func(SelectQuery), alias ...string) MergeQuery
func (*BunMergeQuery) UsingTable ¶ added in v0.7.1
func (q *BunMergeQuery) UsingTable(table string, alias ...string) MergeQuery
func (*BunMergeQuery) WhenMatched ¶
func (q *BunMergeQuery) WhenMatched(builder ...func(ConditionBuilder)) MergeWhenBuilder
func (*BunMergeQuery) WhenNotMatched ¶
func (q *BunMergeQuery) WhenNotMatched(builder ...func(ConditionBuilder)) MergeWhenBuilder
func (*BunMergeQuery) WhenNotMatchedBySource ¶
func (q *BunMergeQuery) WhenNotMatchedBySource(builder ...func(ConditionBuilder)) MergeWhenBuilder
func (*BunMergeQuery) WhenNotMatchedByTarget ¶ added in v0.7.1
func (q *BunMergeQuery) WhenNotMatchedByTarget(builder ...func(ConditionBuilder)) MergeWhenBuilder
func (*BunMergeQuery) With ¶
func (q *BunMergeQuery) With(name string, builder func(SelectQuery)) MergeQuery
func (*BunMergeQuery) WithRecursive ¶
func (q *BunMergeQuery) WithRecursive(name string, builder func(SelectQuery)) MergeQuery
func (*BunMergeQuery) WithValues ¶
func (q *BunMergeQuery) WithValues(name string, model any, withOrder ...bool) MergeQuery
type BunSelectQuery ¶
type BunSelectQuery struct {
QueryBuilder
// contains filtered or unexported fields
}
BunSelectQuery is the concrete implementation of SelectQuery interface. It wraps bun.SelectQuery and provides additional functionality for expression building.
func NewSelectQuery ¶
func NewSelectQuery(db *BunDB) *BunSelectQuery
NewSelectQuery creates a new SelectQuery instance with the provided database instance. It initializes the query builders and sets up the table schema context for proper query building.
func (*BunSelectQuery) Apply ¶
func (q *BunSelectQuery) Apply(fns ...ApplyFunc[SelectQuery]) SelectQuery
func (*BunSelectQuery) ApplyIf ¶
func (q *BunSelectQuery) ApplyIf(condition bool, fns ...ApplyFunc[SelectQuery]) SelectQuery
func (*BunSelectQuery) CrossJoin ¶ added in v0.7.1
func (q *BunSelectQuery) CrossJoin(model any, alias ...string) SelectQuery
func (*BunSelectQuery) CrossJoinExpr ¶ added in v0.7.1
func (q *BunSelectQuery) CrossJoinExpr(eBuilder func(ExprBuilder) any, alias ...string) SelectQuery
func (*BunSelectQuery) CrossJoinSubQuery ¶ added in v0.7.1
func (q *BunSelectQuery) CrossJoinSubQuery(sqBuilder func(query SelectQuery), alias ...string) SelectQuery
func (*BunSelectQuery) CrossJoinTable ¶ added in v0.7.1
func (q *BunSelectQuery) CrossJoinTable(name string, alias ...string) SelectQuery
func (*BunSelectQuery) DB ¶ added in v0.18.0
func (q *BunSelectQuery) DB() DB
func (*BunSelectQuery) Distinct ¶
func (q *BunSelectQuery) Distinct() SelectQuery
func (*BunSelectQuery) DistinctOnColumns ¶
func (q *BunSelectQuery) DistinctOnColumns(columns ...string) SelectQuery
func (*BunSelectQuery) DistinctOnExpr ¶
func (q *BunSelectQuery) DistinctOnExpr(builder func(ExprBuilder) any) SelectQuery
func (*BunSelectQuery) Except ¶
func (q *BunSelectQuery) Except(builder func(query SelectQuery)) SelectQuery
func (*BunSelectQuery) ExceptAll ¶
func (q *BunSelectQuery) ExceptAll(builder func(query SelectQuery)) SelectQuery
func (*BunSelectQuery) Exclude ¶
func (q *BunSelectQuery) Exclude(columns ...string) SelectQuery
func (*BunSelectQuery) ExcludeAll ¶
func (q *BunSelectQuery) ExcludeAll() SelectQuery
func (*BunSelectQuery) ForShare ¶
func (q *BunSelectQuery) ForShare(tables ...string) SelectQuery
func (*BunSelectQuery) ForShareNoWait ¶
func (q *BunSelectQuery) ForShareNoWait(tables ...string) SelectQuery
func (*BunSelectQuery) ForShareSkipLocked ¶
func (q *BunSelectQuery) ForShareSkipLocked(tables ...string) SelectQuery
func (*BunSelectQuery) ForUpdate ¶
func (q *BunSelectQuery) ForUpdate(tables ...string) SelectQuery
func (*BunSelectQuery) ForUpdateNoWait ¶
func (q *BunSelectQuery) ForUpdateNoWait(tables ...string) SelectQuery
func (*BunSelectQuery) ForUpdateSkipLocked ¶
func (q *BunSelectQuery) ForUpdateSkipLocked(tables ...string) SelectQuery
func (*BunSelectQuery) FullJoin ¶ added in v0.7.1
func (q *BunSelectQuery) FullJoin(model any, builder func(ConditionBuilder), alias ...string) SelectQuery
func (*BunSelectQuery) FullJoinExpr ¶ added in v0.7.1
func (q *BunSelectQuery) FullJoinExpr(eBuilder func(ExprBuilder) any, cBuilder func(ConditionBuilder), alias ...string) SelectQuery
func (*BunSelectQuery) FullJoinSubQuery ¶ added in v0.7.1
func (q *BunSelectQuery) FullJoinSubQuery(sqBuilder func(query SelectQuery), cBuilder func(ConditionBuilder), alias ...string) SelectQuery
func (*BunSelectQuery) FullJoinTable ¶ added in v0.7.1
func (q *BunSelectQuery) FullJoinTable(name string, builder func(ConditionBuilder), alias ...string) SelectQuery
func (*BunSelectQuery) GroupBy ¶
func (q *BunSelectQuery) GroupBy(columns ...string) SelectQuery
func (*BunSelectQuery) GroupByExpr ¶
func (q *BunSelectQuery) GroupByExpr(builder func(ExprBuilder) any) SelectQuery
func (*BunSelectQuery) Having ¶
func (q *BunSelectQuery) Having(builder func(ConditionBuilder)) SelectQuery
func (*BunSelectQuery) IncludeDeleted ¶
func (q *BunSelectQuery) IncludeDeleted() SelectQuery
func (*BunSelectQuery) Intersect ¶
func (q *BunSelectQuery) Intersect(builder func(query SelectQuery)) SelectQuery
func (*BunSelectQuery) IntersectAll ¶
func (q *BunSelectQuery) IntersectAll(builder func(query SelectQuery)) SelectQuery
func (*BunSelectQuery) Join ¶
func (q *BunSelectQuery) Join(model any, builder func(ConditionBuilder), alias ...string) SelectQuery
func (*BunSelectQuery) JoinExpr ¶
func (q *BunSelectQuery) JoinExpr(eBuilder func(ExprBuilder) any, cBuilder func(ConditionBuilder), alias ...string) SelectQuery
func (*BunSelectQuery) JoinRelations ¶
func (q *BunSelectQuery) JoinRelations(specs ...*RelationSpec) SelectQuery
func (*BunSelectQuery) JoinSubQuery ¶
func (q *BunSelectQuery) JoinSubQuery(sqBuilder func(query SelectQuery), cBuilder func(ConditionBuilder), alias ...string) SelectQuery
func (*BunSelectQuery) JoinTable ¶
func (q *BunSelectQuery) JoinTable(name string, builder func(ConditionBuilder), alias ...string) SelectQuery
func (*BunSelectQuery) LeftJoin ¶
func (q *BunSelectQuery) LeftJoin(model any, builder func(ConditionBuilder), alias ...string) SelectQuery
func (*BunSelectQuery) LeftJoinExpr ¶
func (q *BunSelectQuery) LeftJoinExpr(eBuilder func(ExprBuilder) any, cBuilder func(ConditionBuilder), alias ...string) SelectQuery
func (*BunSelectQuery) LeftJoinSubQuery ¶
func (q *BunSelectQuery) LeftJoinSubQuery(sqBuilder func(query SelectQuery), cBuilder func(ConditionBuilder), alias ...string) SelectQuery
func (*BunSelectQuery) LeftJoinTable ¶
func (q *BunSelectQuery) LeftJoinTable(name string, builder func(ConditionBuilder), alias ...string) SelectQuery
func (*BunSelectQuery) Limit ¶
func (q *BunSelectQuery) Limit(limit int) SelectQuery
func (*BunSelectQuery) Model ¶
func (q *BunSelectQuery) Model(model any) SelectQuery
func (*BunSelectQuery) ModelTable ¶
func (q *BunSelectQuery) ModelTable(name string, alias ...string) SelectQuery
func (*BunSelectQuery) Offset ¶
func (q *BunSelectQuery) Offset(offset int) SelectQuery
func (*BunSelectQuery) OrderBy ¶
func (q *BunSelectQuery) OrderBy(columns ...string) SelectQuery
func (*BunSelectQuery) OrderByDesc ¶
func (q *BunSelectQuery) OrderByDesc(columns ...string) SelectQuery
func (*BunSelectQuery) OrderByExpr ¶
func (q *BunSelectQuery) OrderByExpr(builder func(ExprBuilder) any) SelectQuery
func (*BunSelectQuery) Paginate ¶
func (q *BunSelectQuery) Paginate(pageable page.Pageable) SelectQuery
func (*BunSelectQuery) Relation ¶
func (q *BunSelectQuery) Relation(name string, apply ...func(query SelectQuery)) SelectQuery
func (*BunSelectQuery) RightJoin ¶
func (q *BunSelectQuery) RightJoin(model any, builder func(ConditionBuilder), alias ...string) SelectQuery
func (*BunSelectQuery) RightJoinExpr ¶
func (q *BunSelectQuery) RightJoinExpr(eBuilder func(ExprBuilder) any, cBuilder func(ConditionBuilder), alias ...string) SelectQuery
func (*BunSelectQuery) RightJoinSubQuery ¶
func (q *BunSelectQuery) RightJoinSubQuery(sqBuilder func(query SelectQuery), cBuilder func(ConditionBuilder), alias ...string) SelectQuery
func (*BunSelectQuery) RightJoinTable ¶
func (q *BunSelectQuery) RightJoinTable(name string, builder func(ConditionBuilder), alias ...string) SelectQuery
func (*BunSelectQuery) Scan ¶
func (q *BunSelectQuery) Scan(ctx context.Context, dest ...any) (err error)
func (*BunSelectQuery) ScanAndCount ¶
func (*BunSelectQuery) Select ¶
func (q *BunSelectQuery) Select(columns ...string) SelectQuery
func (*BunSelectQuery) SelectAll ¶
func (q *BunSelectQuery) SelectAll() SelectQuery
func (*BunSelectQuery) SelectAs ¶
func (q *BunSelectQuery) SelectAs(column, alias string) SelectQuery
func (*BunSelectQuery) SelectExpr ¶
func (q *BunSelectQuery) SelectExpr(builder func(ExprBuilder) any, alias ...string) SelectQuery
func (*BunSelectQuery) SelectModelColumns ¶
func (q *BunSelectQuery) SelectModelColumns() SelectQuery
func (*BunSelectQuery) SelectModelPKs ¶
func (q *BunSelectQuery) SelectModelPKs() SelectQuery
func (*BunSelectQuery) Table ¶
func (q *BunSelectQuery) Table(name string, alias ...string) SelectQuery
func (*BunSelectQuery) TableExpr ¶
func (q *BunSelectQuery) TableExpr(builder func(ExprBuilder) any, alias ...string) SelectQuery
func (*BunSelectQuery) TableFrom ¶ added in v0.7.1
func (q *BunSelectQuery) TableFrom(model any, alias ...string) SelectQuery
func (*BunSelectQuery) TableSubQuery ¶
func (q *BunSelectQuery) TableSubQuery(builder func(query SelectQuery), alias ...string) SelectQuery
func (*BunSelectQuery) Union ¶
func (q *BunSelectQuery) Union(builder func(query SelectQuery)) SelectQuery
func (*BunSelectQuery) UnionAll ¶
func (q *BunSelectQuery) UnionAll(builder func(query SelectQuery)) SelectQuery
func (*BunSelectQuery) Unwrap ¶
func (q *BunSelectQuery) Unwrap() *bun.SelectQuery
func (*BunSelectQuery) Where ¶
func (q *BunSelectQuery) Where(builder func(ConditionBuilder)) SelectQuery
func (*BunSelectQuery) WhereDeleted ¶
func (q *BunSelectQuery) WhereDeleted() SelectQuery
func (*BunSelectQuery) WherePK ¶
func (q *BunSelectQuery) WherePK(columns ...string) SelectQuery
func (*BunSelectQuery) With ¶
func (q *BunSelectQuery) With(name string, builder func(query SelectQuery)) SelectQuery
func (*BunSelectQuery) WithRecursive ¶
func (q *BunSelectQuery) WithRecursive(name string, builder func(query SelectQuery)) SelectQuery
func (*BunSelectQuery) WithValues ¶
func (q *BunSelectQuery) WithValues(name string, model any, withOrder ...bool) SelectQuery
type BunUpdateQuery ¶
type BunUpdateQuery struct {
QueryBuilder
// contains filtered or unexported fields
}
BunUpdateQuery is the concrete implementation of UpdateQuery interface. It wraps bun.UpdateQuery and provides additional functionality for expression building.
func NewUpdateQuery ¶
func NewUpdateQuery(db *BunDB) *BunUpdateQuery
NewUpdateQuery creates a new UpdateQuery instance with the provided database instance. It initializes the query builders and sets up the table schema context for proper query building.
func (*BunUpdateQuery) Apply ¶
func (q *BunUpdateQuery) Apply(fns ...ApplyFunc[UpdateQuery]) UpdateQuery
func (*BunUpdateQuery) ApplyIf ¶
func (q *BunUpdateQuery) ApplyIf(condition bool, fns ...ApplyFunc[UpdateQuery]) UpdateQuery
func (*BunUpdateQuery) Bulk ¶
func (q *BunUpdateQuery) Bulk() UpdateQuery
func (*BunUpdateQuery) Column ¶
func (q *BunUpdateQuery) Column(name string, value any) UpdateQuery
func (*BunUpdateQuery) ColumnExpr ¶
func (q *BunUpdateQuery) ColumnExpr(name string, builder func(ExprBuilder) any) UpdateQuery
func (*BunUpdateQuery) DB ¶ added in v0.18.0
func (q *BunUpdateQuery) DB() DB
func (*BunUpdateQuery) Exclude ¶
func (q *BunUpdateQuery) Exclude(columns ...string) UpdateQuery
func (*BunUpdateQuery) ExcludeAll ¶
func (q *BunUpdateQuery) ExcludeAll() UpdateQuery
func (*BunUpdateQuery) IncludeDeleted ¶
func (q *BunUpdateQuery) IncludeDeleted() UpdateQuery
func (*BunUpdateQuery) Limit ¶
func (q *BunUpdateQuery) Limit(limit int) UpdateQuery
func (*BunUpdateQuery) Model ¶
func (q *BunUpdateQuery) Model(model any) UpdateQuery
func (*BunUpdateQuery) ModelTable ¶
func (q *BunUpdateQuery) ModelTable(name string, alias ...string) UpdateQuery
func (*BunUpdateQuery) OmitZero ¶
func (q *BunUpdateQuery) OmitZero() UpdateQuery
func (*BunUpdateQuery) OrderBy ¶
func (q *BunUpdateQuery) OrderBy(columns ...string) UpdateQuery
func (*BunUpdateQuery) OrderByDesc ¶
func (q *BunUpdateQuery) OrderByDesc(columns ...string) UpdateQuery
func (*BunUpdateQuery) OrderByExpr ¶
func (q *BunUpdateQuery) OrderByExpr(builder func(ExprBuilder) any) UpdateQuery
func (*BunUpdateQuery) Returning ¶
func (q *BunUpdateQuery) Returning(columns ...string) UpdateQuery
func (*BunUpdateQuery) ReturningAll ¶
func (q *BunUpdateQuery) ReturningAll() UpdateQuery
func (*BunUpdateQuery) ReturningNone ¶
func (q *BunUpdateQuery) ReturningNone() UpdateQuery
func (*BunUpdateQuery) Select ¶
func (q *BunUpdateQuery) Select(columns ...string) UpdateQuery
func (*BunUpdateQuery) SelectAll ¶
func (q *BunUpdateQuery) SelectAll() UpdateQuery
func (*BunUpdateQuery) Set ¶
func (q *BunUpdateQuery) Set(name string, value any) UpdateQuery
func (*BunUpdateQuery) SetExpr ¶
func (q *BunUpdateQuery) SetExpr(name string, builder func(ExprBuilder) any) UpdateQuery
func (*BunUpdateQuery) Table ¶
func (q *BunUpdateQuery) Table(name string, alias ...string) UpdateQuery
func (*BunUpdateQuery) TableExpr ¶
func (q *BunUpdateQuery) TableExpr(builder func(ExprBuilder) any, alias ...string) UpdateQuery
func (*BunUpdateQuery) TableFrom ¶ added in v0.7.1
func (q *BunUpdateQuery) TableFrom(model any, alias ...string) UpdateQuery
func (*BunUpdateQuery) TableSubQuery ¶
func (q *BunUpdateQuery) TableSubQuery(builder func(SelectQuery), alias ...string) UpdateQuery
func (*BunUpdateQuery) Unwrap ¶
func (q *BunUpdateQuery) Unwrap() *bun.UpdateQuery
func (*BunUpdateQuery) Where ¶
func (q *BunUpdateQuery) Where(builder func(ConditionBuilder)) UpdateQuery
func (*BunUpdateQuery) WhereDeleted ¶
func (q *BunUpdateQuery) WhereDeleted() UpdateQuery
func (*BunUpdateQuery) WherePK ¶
func (q *BunUpdateQuery) WherePK(columns ...string) UpdateQuery
func (*BunUpdateQuery) With ¶
func (q *BunUpdateQuery) With(name string, builder func(SelectQuery)) UpdateQuery
func (*BunUpdateQuery) WithRecursive ¶
func (q *BunUpdateQuery) WithRecursive(name string, builder func(SelectQuery)) UpdateQuery
func (*BunUpdateQuery) WithValues ¶
func (q *BunUpdateQuery) WithValues(name string, model any, withOrder ...bool) UpdateQuery
type CTE ¶
type CTE[T QueryExecutor] interface { // With creates a common table expression. With(name string, builder func(query SelectQuery)) T // WithValues creates a common table expression with values. WithValues(name string, model any, withOrder ...bool) T // WithRecursive creates a recursive common table expression. WithRecursive(name string, builder func(query SelectQuery)) T }
CTE is an interface that defines the methods for creating Common Table Expressions (CTEs). CTEs allow you to define temporary result sets that exist only for the duration of a single query.
type CaseBuilder ¶
type CaseBuilder interface {
// Case adds a CASE expression.
Case(expr any) CaseBuilder
// CaseColumn adds a CASE expression with a column.
CaseColumn(column string) CaseBuilder
// CaseSubQuery adds a CASE expression with a subquery.
CaseSubQuery(func(query SelectQuery)) CaseBuilder
// When adds a WHEN condition for searched CASE.
When(func(cb ConditionBuilder)) CaseWhenBuilder
// WhenExpr adds a WHEN expression for searched CASE.
WhenExpr(expr any) CaseWhenBuilder
// WhenSubQuery adds a WHEN subquery for searched CASE.
WhenSubQuery(func(query SelectQuery)) CaseWhenBuilder
Else(expr any)
// ElseSubQuery adds a ELSE subquery for the CASE expression.
ElseSubQuery(func(query SelectQuery))
}
CaseBuilder is an interface for building CASE expressions. Supports both searched CASE (WHEN condition) and simple CASE (WHEN value).
type CaseWhenBuilder ¶
type CaseWhenBuilder interface {
Then(expr any) CaseBuilder
ThenSubQuery(func(query SelectQuery)) CaseBuilder
}
CaseWhenBuilder is an interface for building the THEN part of WHEN clauses.
type ClauseConditionBuilder ¶
type ClauseConditionBuilder struct {
*CriteriaBuilder
// contains filtered or unexported fields
}
ClauseConditionBuilder is responsible for collecting and grouping condition clauses, and rendering them.
func (*ClauseConditionBuilder) And ¶
func (cb *ClauseConditionBuilder) And(query string, args ...any)
func (*ClauseConditionBuilder) AppendConditions ¶
func (cb *ClauseConditionBuilder) AppendConditions(conditions ...schema.QueryWithSep)
func (*ClauseConditionBuilder) AppendGroup ¶
func (cb *ClauseConditionBuilder) AppendGroup(sep string, conditions []schema.QueryWithSep)
func (*ClauseConditionBuilder) AppendQuery ¶
func (*ClauseConditionBuilder) BuildGroup ¶
func (cb *ClauseConditionBuilder) BuildGroup(sep string, builder func(ConditionBuilder))
func (*ClauseConditionBuilder) Or ¶
func (cb *ClauseConditionBuilder) Or(query string, args ...any)
type ColumnHandler ¶ added in v0.7.1
type ColumnHandler interface {
// Name returns the name of the column this handler manages.
Name() string
}
ColumnHandler is the base interface for all auto column handlers. It provides the column name that the handler manages.
type ColumnInfo ¶
type ColumnInfo struct {
// Name is the column name in the database
Name string
// Alias is the custom alias for the column in the result set.
// If empty and AutoAlias is false, the column uses its original name.
Alias string
// AutoAlias automatically generates an alias by prefixing the column name with the model name.
// For example, if model is "User" and column is "name", the alias becomes "user_name".
// This helps avoid column name conflicts when joining multiple tables.
AutoAlias bool
}
ColumnInfo represents the configuration for selecting a column from a related model.
type ColumnUpdatable ¶
type ColumnUpdatable[T QueryExecutor] interface { // Column sets a column to a specific value. Column(name string, value any) T // ColumnExpr sets a column using an expression builder. ColumnExpr(name string, builder func(ExprBuilder) any) T }
ColumnUpdatable is an interface that defines the methods for setting column values in queries. It supports both direct value assignment and expression-based column updates.
type ConditionBuilder ¶
type ConditionBuilder interface {
Applier[ConditionBuilder]
AuditConditionBuilder
PKConditionBuilder
// Equals is a condition that checks if a column is equal to a value.
Equals(column string, value any) ConditionBuilder
// OrEquals is a condition that checks if a column is equal to a value.
OrEquals(column string, value any) ConditionBuilder
// EqualsColumn is a condition that checks if a column is equal to another column.
EqualsColumn(column1, column2 string) ConditionBuilder
// OrEqualsColumn is a condition that checks if a column is equal to another column.
OrEqualsColumn(column1, column2 string) ConditionBuilder
// EqualsSubQuery is a condition that checks if a column is equal to a subquery.
EqualsSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
// OrEqualsSubQuery is a condition that checks if a column is equal to a subquery.
OrEqualsSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
// EqualsAny is a condition that checks if a column is equal to any value returned by a subquery.
EqualsAny(column string, builder func(query SelectQuery)) ConditionBuilder
// OrEqualsAny is a condition that checks if a column is equal to any value returned by a subquery.
OrEqualsAny(column string, builder func(query SelectQuery)) ConditionBuilder
// EqualsAll is a condition that checks if a column is equal to all values returned by a subquery.
EqualsAll(column string, builder func(query SelectQuery)) ConditionBuilder
// OrEqualsAll is a condition that checks if a column is equal to all values returned by a subquery.
OrEqualsAll(column string, builder func(query SelectQuery)) ConditionBuilder
// EqualsExpr is a condition that checks if a column is equal to an expression.
EqualsExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
// OrEqualsExpr is a condition that checks if a column is equal to an expression.
OrEqualsExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
// NotEquals is a condition that checks if a column is not equal to a value.
NotEquals(column string, value any) ConditionBuilder
// OrNotEquals is a condition that checks if a column is not equal to a value.
OrNotEquals(column string, value any) ConditionBuilder
// NotEqualsColumn is a condition that checks if a column is not equal to another column.
NotEqualsColumn(column1, column2 string) ConditionBuilder
// OrNotEqualsColumn is a condition that checks if a column is not equal to another column.
OrNotEqualsColumn(column1, column2 string) ConditionBuilder
// NotEqualsSubQuery is a condition that checks if a column is not equal to a subquery.
NotEqualsSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
// OrNotEqualsSubQuery is a condition that checks if a column is not equal to a subquery.
OrNotEqualsSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
// NotEqualsAny is a condition that checks if a column is not equal to any value returned by a subquery.
NotEqualsAny(column string, builder func(query SelectQuery)) ConditionBuilder
// OrNotEqualsAny is a condition that checks if a column is not equal to any value returned by a subquery.
OrNotEqualsAny(column string, builder func(query SelectQuery)) ConditionBuilder
// NotEqualsAll is a condition that checks if a column is not equal to all values returned by a subquery.
NotEqualsAll(column string, builder func(query SelectQuery)) ConditionBuilder
// OrNotEqualsAll is a condition that checks if a column is not equal to all values returned by a subquery.
OrNotEqualsAll(column string, builder func(query SelectQuery)) ConditionBuilder
// NotEqualsExpr is a condition that checks if a column is not equal to an expression.
NotEqualsExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
// OrNotEqualsExpr is a condition that checks if a column is not equal to an expression.
OrNotEqualsExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
// GreaterThan is a condition that checks if a column is greater than a value.
GreaterThan(column string, value any) ConditionBuilder
// OrGreaterThan is a condition that checks if a column is greater than a value.
OrGreaterThan(column string, value any) ConditionBuilder
// GreaterThanColumn is a condition that checks if a column is greater than another column.
GreaterThanColumn(column1, column2 string) ConditionBuilder
// OrGreaterThanColumn is a condition that checks if a column is greater than another column.
OrGreaterThanColumn(column1, column2 string) ConditionBuilder
// GreaterThanSubQuery is a condition that checks if a column is greater than a subquery.
GreaterThanSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
// OrGreaterThanSubQuery is a condition that checks if a column is greater than a subquery.
OrGreaterThanSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
// GreaterThanAny is a condition that checks if a column is greater than any value returned by a subquery.
GreaterThanAny(column string, builder func(query SelectQuery)) ConditionBuilder
// OrGreaterThanAny is a condition that checks if a column is greater than any value returned by a subquery.
OrGreaterThanAny(column string, builder func(query SelectQuery)) ConditionBuilder
// GreaterThanAll is a condition that checks if a column is greater than all values returned by a subquery.
GreaterThanAll(column string, builder func(query SelectQuery)) ConditionBuilder
// OrGreaterThanAll is a condition that checks if a column is greater than all values returned by a subquery.
OrGreaterThanAll(column string, builder func(query SelectQuery)) ConditionBuilder
// GreaterThanExpr is a condition that checks if a column is greater than an expression.
GreaterThanExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
// OrGreaterThanExpr is a condition that checks if a column is greater than an expression.
OrGreaterThanExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
// GreaterThanOrEqual is a condition that checks if a column is greater than or equal to a value.
GreaterThanOrEqual(column string, value any) ConditionBuilder
// OrGreaterThanOrEqual is a condition that checks if a column is greater than or equal to a value.
OrGreaterThanOrEqual(column string, value any) ConditionBuilder
// GreaterThanOrEqualColumn is a condition that checks if a column is greater than or equal to another column.
GreaterThanOrEqualColumn(column1, column2 string) ConditionBuilder
// OrGreaterThanOrEqualColumn is a condition that checks if a column is greater than or equal to another column.
OrGreaterThanOrEqualColumn(column1, column2 string) ConditionBuilder
// GreaterThanOrEqualSubQuery is a condition that checks if a column is greater than or equal to a subquery.
GreaterThanOrEqualSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
// OrGreaterThanOrEqualSubQuery is a condition that checks if a column is greater than or equal to a subquery.
OrGreaterThanOrEqualSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
// GreaterThanOrEqualAny is a condition that checks if a column is greater than or equal to any value returned by a subquery.
GreaterThanOrEqualAny(column string, builder func(query SelectQuery)) ConditionBuilder
// OrGreaterThanOrEqualAny is a condition that checks if a column is greater than or equal to any value returned by a subquery.
OrGreaterThanOrEqualAny(column string, builder func(query SelectQuery)) ConditionBuilder
// GreaterThanOrEqualAll is a condition that checks if a column is greater than or equal to all values returned by a subquery.
GreaterThanOrEqualAll(column string, builder func(query SelectQuery)) ConditionBuilder
// OrGreaterThanOrEqualAll is a condition that checks if a column is greater than or equal to all values returned by a subquery.
OrGreaterThanOrEqualAll(column string, builder func(query SelectQuery)) ConditionBuilder
// GreaterThanOrEqualExpr is a condition that checks if a column is greater than or equal to an expression.
GreaterThanOrEqualExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
// OrGreaterThanOrEqualExpr is a condition that checks if a column is greater than or equal to an expression.
OrGreaterThanOrEqualExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
// LessThan is a condition that checks if a column is less than a value.
LessThan(column string, value any) ConditionBuilder
// OrLessThan is a condition that checks if a column is less than a value.
OrLessThan(column string, value any) ConditionBuilder
// LessThanColumn is a condition that checks if a column is less than another column.
LessThanColumn(column1, column2 string) ConditionBuilder
// OrLessThanColumn is a condition that checks if a column is less than another column.
OrLessThanColumn(column1, column2 string) ConditionBuilder
// LessThanSubQuery is a condition that checks if a column is less than a subquery.
LessThanSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
// OrLessThanSubQuery is a condition that checks if a column is less than a subquery.
OrLessThanSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
// LessThanAny is a condition that checks if a column is less than any value returned by a subquery.
LessThanAny(column string, builder func(query SelectQuery)) ConditionBuilder
// OrLessThanAny is a condition that checks if a column is less than any value returned by a subquery.
OrLessThanAny(column string, builder func(query SelectQuery)) ConditionBuilder
// LessThanAll is a condition that checks if a column is less than all values returned by a subquery.
LessThanAll(column string, builder func(query SelectQuery)) ConditionBuilder
// OrLessThanAll is a condition that checks if a column is less than all values returned by a subquery.
OrLessThanAll(column string, builder func(query SelectQuery)) ConditionBuilder
// LessThanExpr is a condition that checks if a column is less than an expression.
LessThanExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
// OrLessThanExpr is a condition that checks if a column is less than an expression.
OrLessThanExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
// LessThanOrEqual is a condition that checks if a column is less than or equal to a value.
LessThanOrEqual(column string, value any) ConditionBuilder
// OrLessThanOrEqual is a condition that checks if a column is less than or equal to a value.
OrLessThanOrEqual(column string, value any) ConditionBuilder
// LessThanOrEqualColumn is a condition that checks if a column is less than or equal to another column.
LessThanOrEqualColumn(column1, column2 string) ConditionBuilder
// OrLessThanOrEqualColumn is a condition that checks if a column is less than or equal to another column.
OrLessThanOrEqualColumn(column1, column2 string) ConditionBuilder
// LessThanOrEqualSubQuery is a condition that checks if a column is less than or equal to a subquery.
LessThanOrEqualSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
// OrLessThanOrEqualSubQuery is a condition that checks if a column is less than or equal to a subquery.
OrLessThanOrEqualSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
// LessThanOrEqualAny is a condition that checks if a column is less than or equal to any value returned by a subquery.
LessThanOrEqualAny(column string, builder func(query SelectQuery)) ConditionBuilder
// OrLessThanOrEqualAny is a condition that checks if a column is less than or equal to any value returned by a subquery.
OrLessThanOrEqualAny(column string, builder func(query SelectQuery)) ConditionBuilder
// LessThanOrEqualAll is a condition that checks if a column is less than or equal to all values returned by a subquery.
LessThanOrEqualAll(column string, builder func(query SelectQuery)) ConditionBuilder
// OrLessThanOrEqualAll is a condition that checks if a column is less than or equal to all values returned by a subquery.
OrLessThanOrEqualAll(column string, builder func(query SelectQuery)) ConditionBuilder
// LessThanOrEqualExpr is a condition that checks if a column is less than or equal to an expression.
LessThanOrEqualExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
// OrLessThanOrEqualExpr is a condition that checks if a column is less than or equal to an expression.
OrLessThanOrEqualExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
// Between is a condition that checks if a column is between two values.
Between(column string, start, end any) ConditionBuilder
// OrBetween is a condition that checks if a column is between two values.
OrBetween(column string, start, end any) ConditionBuilder
// BetweenExpr is a condition that checks if a column is between an expression and a value.
BetweenExpr(column string, startB, endB func(ExprBuilder) any) ConditionBuilder
// OrBetweenExpr is a condition that checks if a column is between an expression and a value.
OrBetweenExpr(column string, startB, endB func(ExprBuilder) any) ConditionBuilder
// NotBetween is a condition that checks if a column is not between two values.
NotBetween(column string, start, end any) ConditionBuilder
// OrNotBetween is a condition that checks if a column is not between two values.
OrNotBetween(column string, start, end any) ConditionBuilder
// NotBetweenExpr is a condition that checks if a column is not between an expression and a value.
NotBetweenExpr(column string, startB, endB func(ExprBuilder) any) ConditionBuilder
// OrNotBetweenExpr is a condition that checks if a column is not between an expression and a value.
OrNotBetweenExpr(column string, startB, endB func(ExprBuilder) any) ConditionBuilder
// In is a condition that checks if a column is in a list of values.
In(column string, values any) ConditionBuilder
// OrIn is a condition that checks if a column is in a list of values.
OrIn(column string, values any) ConditionBuilder
// InSubQuery is a condition that checks if a column is in a subquery.
InSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
// OrInSubQuery is a condition that checks if a column is in a subquery.
OrInSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
// InExpr is a condition that checks if a column is in an expression.
InExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
// OrInExpr is a condition that checks if a column is in an expression.
OrInExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
// NotIn is a condition that checks if a column is not in a list of values.
NotIn(column string, values any) ConditionBuilder
// OrNotIn is a condition that checks if a column is not in a list of values.
OrNotIn(column string, values any) ConditionBuilder
// NotInSubQuery is a condition that checks if a column is not in a subquery.
NotInSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
// OrNotInSubQuery is a condition that checks if a column is not in a subquery.
OrNotInSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
// NotInExpr is a condition that checks if a column is not in an expression.
NotInExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
// OrNotInExpr is a condition that checks if a column is not in an expression.
OrNotInExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
// IsNull is a condition that checks if a column is null.
IsNull(column string) ConditionBuilder
// OrIsNull is a condition that checks if a column is null.
OrIsNull(column string) ConditionBuilder
// IsNullSubQuery is a condition that checks if a column is null.
IsNullSubQuery(builder func(query SelectQuery)) ConditionBuilder
// OrIsNullSubQuery is a condition that checks if a column is null.
OrIsNullSubQuery(builder func(query SelectQuery)) ConditionBuilder
// IsNullExpr is a condition that checks if a column is null.
IsNullExpr(builder func(ExprBuilder) any) ConditionBuilder
// OrIsNullExpr is a condition that checks if a column is null.
OrIsNullExpr(builder func(ExprBuilder) any) ConditionBuilder
// IsNotNull is a condition that checks if a column is not null.
IsNotNull(column string) ConditionBuilder
// OrIsNotNull is a condition that checks if a column is not null.
OrIsNotNull(column string) ConditionBuilder
// IsNotNullSubQuery is a condition that checks if a column is not null.
IsNotNullSubQuery(builder func(query SelectQuery)) ConditionBuilder
// OrIsNotNullSubQuery is a condition that checks if a column is not null.
OrIsNotNullSubQuery(builder func(query SelectQuery)) ConditionBuilder
// IsNotNullExpr is a condition that checks if a column is not null.
IsNotNullExpr(builder func(ExprBuilder) any) ConditionBuilder
// OrIsNotNullExpr is a condition that checks if a column is not null.
OrIsNotNullExpr(builder func(ExprBuilder) any) ConditionBuilder
// IsTrue is a condition that checks if a column is true.
IsTrue(column string) ConditionBuilder
// OrIsTrue is a condition that checks if a column is true.
OrIsTrue(column string) ConditionBuilder
// IsTrueSubQuery is a condition that checks if a column is true.
IsTrueSubQuery(builder func(query SelectQuery)) ConditionBuilder
// OrIsTrueSubQuery is a condition that checks if a column is true.
OrIsTrueSubQuery(builder func(query SelectQuery)) ConditionBuilder
// IsTrueExpr is a condition that checks if a column is true.
IsTrueExpr(builder func(ExprBuilder) any) ConditionBuilder
// OrIsTrueExpr is a condition that checks if a column is true.
OrIsTrueExpr(builder func(ExprBuilder) any) ConditionBuilder
// IsFalse is a condition that checks if a column is false.
IsFalse(column string) ConditionBuilder
// OrIsFalse is a condition that checks if a column is false.
OrIsFalse(column string) ConditionBuilder
// IsFalseSubQuery is a condition that checks if a column is false.
IsFalseSubQuery(builder func(query SelectQuery)) ConditionBuilder
// OrIsFalseSubQuery is a condition that checks if a column is false.
OrIsFalseSubQuery(builder func(query SelectQuery)) ConditionBuilder
// IsFalseExpr is a condition that checks if a column is false.
IsFalseExpr(builder func(ExprBuilder) any) ConditionBuilder
// OrIsFalseExpr is a condition that checks if a column is false.
OrIsFalseExpr(builder func(ExprBuilder) any) ConditionBuilder
// Contains is a condition that checks if a column contains a value.
Contains(column, value string) ConditionBuilder
// OrContains is a condition that checks if a column contains a value.
OrContains(column, value string) ConditionBuilder
// ContainsAny is a condition that checks if a column contains any of the values.
ContainsAny(column string, values []string) ConditionBuilder
// OrContainsAny is a condition that checks if a column contains any of the values.
OrContainsAny(column string, values []string) ConditionBuilder
// ContainsIgnoreCase is a condition that checks if a column contains a value, ignoring case.
ContainsIgnoreCase(column, value string) ConditionBuilder
// OrContainsIgnoreCase is a condition that checks if a column contains a value, ignoring case.
OrContainsIgnoreCase(column, value string) ConditionBuilder
// ContainsAnyIgnoreCase is a condition that checks if a column contains any of the values, ignoring case.
ContainsAnyIgnoreCase(column string, values []string) ConditionBuilder
// OrContainsAnyIgnoreCase is a condition that checks if a column contains any of the values, ignoring case.
OrContainsAnyIgnoreCase(column string, values []string) ConditionBuilder
// NotContains is a condition that checks if a column does not contain a value.
NotContains(column, value string) ConditionBuilder
// OrNotContains is a condition that checks if a column does not contain a value.
OrNotContains(column, value string) ConditionBuilder
// NotContainsAny is a condition that checks if a column does not contain any of the values.
NotContainsAny(column string, values []string) ConditionBuilder
// OrNotContainsAny is a condition that checks if a column does not contain any of the values.
OrNotContainsAny(column string, values []string) ConditionBuilder
// NotContainsIgnoreCase is a condition that checks if a column does not contain a value, ignoring case.
NotContainsIgnoreCase(column, value string) ConditionBuilder
// OrNotContainsIgnoreCase is a condition that checks if a column does not contain a value, ignoring case.
OrNotContainsIgnoreCase(column, value string) ConditionBuilder
// NotContainsAnyIgnoreCase is a condition that checks if a column does not contain any of the values, ignoring case.
NotContainsAnyIgnoreCase(column string, values []string) ConditionBuilder
// OrNotContainsAnyIgnoreCase is a condition that checks if a column does not contain any of the values, ignoring case.
OrNotContainsAnyIgnoreCase(column string, values []string) ConditionBuilder
// StartsWith is a condition that checks if a column starts with a value.
StartsWith(column, value string) ConditionBuilder
// OrStartsWith is a condition that checks if a column starts with a value.
OrStartsWith(column, value string) ConditionBuilder
// StartsWithAny is a condition that checks if a column starts with any of the values.
StartsWithAny(column string, values []string) ConditionBuilder
// OrStartsWithAny is a condition that checks if a column starts with any of the values.
OrStartsWithAny(column string, values []string) ConditionBuilder
// StartsWithIgnoreCase is a condition that checks if a column starts with a value, ignoring case.
StartsWithIgnoreCase(column, value string) ConditionBuilder
// OrStartsWithIgnoreCase is a condition that checks if a column starts with a value, ignoring case.
OrStartsWithIgnoreCase(column, value string) ConditionBuilder
// StartsWithAnyIgnoreCase is a condition that checks if a column starts with any of the values, ignoring case.
StartsWithAnyIgnoreCase(column string, values []string) ConditionBuilder
// OrStartsWithAnyIgnoreCase is a condition that checks if a column starts with any of the values, ignoring case.
OrStartsWithAnyIgnoreCase(column string, values []string) ConditionBuilder
// NotStartsWith is a condition that checks if a column does not start with a value.
NotStartsWith(column, value string) ConditionBuilder
// OrNotStartsWith is a condition that checks if a column does not start with a value.
OrNotStartsWith(column, value string) ConditionBuilder
// NotStartsWithAny is a condition that checks if a column does not start with any of the values.
NotStartsWithAny(column string, values []string) ConditionBuilder
// OrNotStartsWithAny is a condition that checks if a column does not start with any of the values.
OrNotStartsWithAny(column string, values []string) ConditionBuilder
// NotStartsWithIgnoreCase is a condition that checks if a column does not start with a value, ignoring case.
NotStartsWithIgnoreCase(column, value string) ConditionBuilder
// OrNotStartsWithIgnoreCase is a condition that checks if a column does not start with a value, ignoring case.
OrNotStartsWithIgnoreCase(column, value string) ConditionBuilder
// NotStartsWithAnyIgnoreCase is a condition that checks if a column does not start with any of the values, ignoring case.
NotStartsWithAnyIgnoreCase(column string, values []string) ConditionBuilder
// OrNotStartsWithAnyIgnoreCase is a condition that checks if a column does not start with any of the values, ignoring case.
OrNotStartsWithAnyIgnoreCase(column string, values []string) ConditionBuilder
// EndsWith is a condition that checks if a column ends with a value.
EndsWith(column, value string) ConditionBuilder
// OrEndsWith is a condition that checks if a column ends with a value.
OrEndsWith(column, value string) ConditionBuilder
// EndsWithAny is a condition that checks if a column ends with any of the values.
EndsWithAny(column string, values []string) ConditionBuilder
// OrEndsWithAny is a condition that checks if a column ends with any of the values.
OrEndsWithAny(column string, values []string) ConditionBuilder
// EndsWithIgnoreCase is a condition that checks if a column ends with a value, ignoring case.
EndsWithIgnoreCase(column, value string) ConditionBuilder
// OrEndsWithIgnoreCase is a condition that checks if a column ends with a value, ignoring case.
OrEndsWithIgnoreCase(column, value string) ConditionBuilder
// EndsWithAnyIgnoreCase is a condition that checks if a column ends with any of the values, ignoring case.
EndsWithAnyIgnoreCase(column string, values []string) ConditionBuilder
// OrEndsWithAnyIgnoreCase is a condition that checks if a column ends with any of the values, ignoring case.
OrEndsWithAnyIgnoreCase(column string, values []string) ConditionBuilder
// NotEndsWith is a condition that checks if a column does not end with a value.
NotEndsWith(column, value string) ConditionBuilder
// OrNotEndsWith is a condition that checks if a column does not end with a value.
OrNotEndsWith(column, value string) ConditionBuilder
// NotEndsWithAny is a condition that checks if a column does not end with any of the values.
NotEndsWithAny(column string, values []string) ConditionBuilder
// OrNotEndsWithAny is a condition that checks if a column does not end with any of the values.
OrNotEndsWithAny(column string, values []string) ConditionBuilder
// NotEndsWithIgnoreCase is a condition that checks if a column does not end with a value, ignoring case.
NotEndsWithIgnoreCase(column, value string) ConditionBuilder
// OrNotEndsWithIgnoreCase is a condition that checks if a column does not end with a value, ignoring case.
OrNotEndsWithIgnoreCase(column, value string) ConditionBuilder
// NotEndsWithAnyIgnoreCase is a condition that checks if a column does not end with any of the values, ignoring case.
NotEndsWithAnyIgnoreCase(column string, values []string) ConditionBuilder
// OrNotEndsWithAnyIgnoreCase is a condition that checks if a column does not end with any of the values, ignoring case.
OrNotEndsWithAnyIgnoreCase(column string, values []string) ConditionBuilder
// Expr is a condition that checks if an expression is true.
Expr(builder func(ExprBuilder) any) ConditionBuilder
// OrExpr is a condition that checks if an expression is true.
OrExpr(builder func(ExprBuilder) any) ConditionBuilder
// Group is a condition that checks if a group of conditions are true.
Group(builder func(ConditionBuilder)) ConditionBuilder
// OrGroup is a condition that checks if a group of conditions are true.
OrGroup(builder func(ConditionBuilder)) ConditionBuilder
}
ConditionBuilder is a builder for conditions.
type ConflictAction ¶
type ConflictAction int
ConflictAction represents the action strategy for INSERT ... ON CONFLICT.
const ( ConflictDoNothing ConflictAction = iota ConflictDoUpdate )
func (ConflictAction) String ¶
func (c ConflictAction) String() string
type ConflictBuilder ¶
type ConflictBuilder interface {
Columns(columns ...string) ConflictBuilder
Constraint(name string) ConflictBuilder
Where(func(ConditionBuilder)) ConflictBuilder
// DoNothing performs DO NOTHING on conflict and finalizes the conflict handling.
DoNothing()
// DoUpdate performs DO UPDATE on conflict and returns a builder for update operations.
DoUpdate() ConflictUpdateBuilder
}
ConflictBuilder is used to configure INSERT conflict handling (UPSERT) target in a dialect-aware way. This is the first stage that defines the conflict target (columns, constraints, conditions).
type ConflictUpdateBuilder ¶
type ConflictUpdateBuilder interface {
// Set adds an assignment in DO UPDATE clause. If no value provided, uses excluded/VALUES value when supported.
Set(column string, value ...any) ConflictUpdateBuilder
// SetExpr adds an expression assignment in DO UPDATE clause.
SetExpr(column string, builder func(ExprBuilder) any) ConflictUpdateBuilder
// Where adds a predicate to DO UPDATE (PostgreSQL/SQLite). Ignored on MySQL.
Where(func(ConditionBuilder)) ConflictUpdateBuilder
}
ConflictUpdateBuilder is used to configure the UPDATE part of conflict handling. This is the second stage that defines what to update when conflicts occur.
type CountBuilder ¶
type CountBuilder interface {
BaseAggregate[CountBuilder]
DistinctableAggregate[CountBuilder]
// All configures COUNT(*) semantics.
All() CountBuilder
}
CountBuilder defines the COUNT aggregate function builder.
type CreatedAtHandler ¶ added in v0.7.1
type CreatedAtHandler struct{}
CreatedAtHandler implements InsertHandler for automatically setting created_at timestamps.
func (*CreatedAtHandler) Name ¶ added in v0.7.1
func (*CreatedAtHandler) Name() string
type CreatedByHandler ¶ added in v0.7.1
type CreatedByHandler struct{}
CreatedByHandler implements InsertHandler for automatically setting created_by user information.
func (*CreatedByHandler) Name ¶ added in v0.7.1
func (*CreatedByHandler) Name() string
type CreatedModel ¶ added in v0.18.0
type CreatedModel struct {
// CreatedAt is the created at time of the model
CreatedAt datetime.DateTime `json:"createdAt" bun:",notnull,type:timestamp,default:CURRENT_TIMESTAMP,skipupdate"`
// CreatedBy is the created by of the model
CreatedBy string `json:"createdBy" bun:",notnull,skipupdate" mold:"translate=user?"`
// CreatedByName is the created by name of the model
CreatedByName string `json:"createdByName" bun:",scanonly"`
}
CreatedModel contains creation tracking fields.
type CriteriaBuilder ¶
type CriteriaBuilder struct {
// contains filtered or unexported fields
}
func (*CriteriaBuilder) Apply ¶
func (cb *CriteriaBuilder) Apply(fns ...ApplyFunc[ConditionBuilder]) ConditionBuilder
func (*CriteriaBuilder) ApplyIf ¶
func (cb *CriteriaBuilder) ApplyIf(condition bool, fns ...ApplyFunc[ConditionBuilder]) ConditionBuilder
func (*CriteriaBuilder) Between ¶
func (cb *CriteriaBuilder) Between(column string, start, end any) ConditionBuilder
func (*CriteriaBuilder) BetweenExpr ¶
func (cb *CriteriaBuilder) BetweenExpr(column string, startB, endB func(ExprBuilder) any) ConditionBuilder
func (*CriteriaBuilder) Contains ¶
func (cb *CriteriaBuilder) Contains(column, value string) ConditionBuilder
func (*CriteriaBuilder) ContainsAny ¶
func (cb *CriteriaBuilder) ContainsAny(column string, values []string) ConditionBuilder
func (*CriteriaBuilder) ContainsAnyIgnoreCase ¶
func (cb *CriteriaBuilder) ContainsAnyIgnoreCase(column string, values []string) ConditionBuilder
func (*CriteriaBuilder) ContainsIgnoreCase ¶
func (cb *CriteriaBuilder) ContainsIgnoreCase(column, value string) ConditionBuilder
func (*CriteriaBuilder) CreatedAtBetween ¶
func (cb *CriteriaBuilder) CreatedAtBetween(start, end time.Time, alias ...string) ConditionBuilder
func (*CriteriaBuilder) CreatedAtGreaterThan ¶
func (cb *CriteriaBuilder) CreatedAtGreaterThan(createdAt time.Time, alias ...string) ConditionBuilder
func (*CriteriaBuilder) CreatedAtGreaterThanOrEqual ¶
func (cb *CriteriaBuilder) CreatedAtGreaterThanOrEqual(createdAt time.Time, alias ...string) ConditionBuilder
func (*CriteriaBuilder) CreatedAtLessThan ¶
func (cb *CriteriaBuilder) CreatedAtLessThan(createdAt time.Time, alias ...string) ConditionBuilder
func (*CriteriaBuilder) CreatedAtLessThanOrEqual ¶
func (cb *CriteriaBuilder) CreatedAtLessThanOrEqual(createdAt time.Time, alias ...string) ConditionBuilder
func (*CriteriaBuilder) CreatedAtNotBetween ¶
func (cb *CriteriaBuilder) CreatedAtNotBetween(start, end time.Time, alias ...string) ConditionBuilder
func (*CriteriaBuilder) CreatedByEquals ¶
func (cb *CriteriaBuilder) CreatedByEquals(createdBy string, alias ...string) ConditionBuilder
func (*CriteriaBuilder) CreatedByEqualsAll ¶ added in v0.7.1
func (cb *CriteriaBuilder) CreatedByEqualsAll(builder func(SelectQuery), alias ...string) ConditionBuilder
func (*CriteriaBuilder) CreatedByEqualsAny ¶ added in v0.7.1
func (cb *CriteriaBuilder) CreatedByEqualsAny(builder func(SelectQuery), alias ...string) ConditionBuilder
func (*CriteriaBuilder) CreatedByEqualsCurrent ¶
func (cb *CriteriaBuilder) CreatedByEqualsCurrent(alias ...string) ConditionBuilder
func (*CriteriaBuilder) CreatedByEqualsSubQuery ¶
func (cb *CriteriaBuilder) CreatedByEqualsSubQuery(builder func(SelectQuery), alias ...string) ConditionBuilder
func (*CriteriaBuilder) CreatedByIn ¶
func (cb *CriteriaBuilder) CreatedByIn(createdBys []string, alias ...string) ConditionBuilder
func (*CriteriaBuilder) CreatedByInSubQuery ¶
func (cb *CriteriaBuilder) CreatedByInSubQuery(builder func(SelectQuery), alias ...string) ConditionBuilder
func (*CriteriaBuilder) CreatedByNotEquals ¶
func (cb *CriteriaBuilder) CreatedByNotEquals(createdBy string, alias ...string) ConditionBuilder
func (*CriteriaBuilder) CreatedByNotEqualsAll ¶ added in v0.7.1
func (cb *CriteriaBuilder) CreatedByNotEqualsAll(builder func(SelectQuery), alias ...string) ConditionBuilder
func (*CriteriaBuilder) CreatedByNotEqualsAny ¶ added in v0.7.1
func (cb *CriteriaBuilder) CreatedByNotEqualsAny(builder func(SelectQuery), alias ...string) ConditionBuilder
func (*CriteriaBuilder) CreatedByNotEqualsCurrent ¶
func (cb *CriteriaBuilder) CreatedByNotEqualsCurrent(alias ...string) ConditionBuilder
func (*CriteriaBuilder) CreatedByNotEqualsSubQuery ¶
func (cb *CriteriaBuilder) CreatedByNotEqualsSubQuery(builder func(SelectQuery), alias ...string) ConditionBuilder
func (*CriteriaBuilder) CreatedByNotIn ¶
func (cb *CriteriaBuilder) CreatedByNotIn(createdBys []string, alias ...string) ConditionBuilder
func (*CriteriaBuilder) CreatedByNotInSubQuery ¶
func (cb *CriteriaBuilder) CreatedByNotInSubQuery(builder func(SelectQuery), alias ...string) ConditionBuilder
func (*CriteriaBuilder) EndsWith ¶
func (cb *CriteriaBuilder) EndsWith(column, value string) ConditionBuilder
func (*CriteriaBuilder) EndsWithAny ¶
func (cb *CriteriaBuilder) EndsWithAny(column string, values []string) ConditionBuilder
func (*CriteriaBuilder) EndsWithAnyIgnoreCase ¶
func (cb *CriteriaBuilder) EndsWithAnyIgnoreCase(column string, values []string) ConditionBuilder
func (*CriteriaBuilder) EndsWithIgnoreCase ¶
func (cb *CriteriaBuilder) EndsWithIgnoreCase(column, value string) ConditionBuilder
func (*CriteriaBuilder) Equals ¶
func (cb *CriteriaBuilder) Equals(column string, value any) ConditionBuilder
func (*CriteriaBuilder) EqualsAll ¶ added in v0.7.1
func (cb *CriteriaBuilder) EqualsAll(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) EqualsAny ¶ added in v0.7.1
func (cb *CriteriaBuilder) EqualsAny(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) EqualsColumn ¶
func (cb *CriteriaBuilder) EqualsColumn(column1, column2 string) ConditionBuilder
func (*CriteriaBuilder) EqualsExpr ¶
func (cb *CriteriaBuilder) EqualsExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
func (*CriteriaBuilder) EqualsSubQuery ¶
func (cb *CriteriaBuilder) EqualsSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) Expr ¶
func (cb *CriteriaBuilder) Expr(builder func(ExprBuilder) any) ConditionBuilder
func (*CriteriaBuilder) GreaterThan ¶
func (cb *CriteriaBuilder) GreaterThan(column string, value any) ConditionBuilder
func (*CriteriaBuilder) GreaterThanAll ¶ added in v0.7.1
func (cb *CriteriaBuilder) GreaterThanAll(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) GreaterThanAny ¶ added in v0.7.1
func (cb *CriteriaBuilder) GreaterThanAny(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) GreaterThanColumn ¶
func (cb *CriteriaBuilder) GreaterThanColumn(column1, column2 string) ConditionBuilder
func (*CriteriaBuilder) GreaterThanExpr ¶
func (cb *CriteriaBuilder) GreaterThanExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
func (*CriteriaBuilder) GreaterThanOrEqual ¶
func (cb *CriteriaBuilder) GreaterThanOrEqual(column string, value any) ConditionBuilder
func (*CriteriaBuilder) GreaterThanOrEqualAll ¶ added in v0.7.1
func (cb *CriteriaBuilder) GreaterThanOrEqualAll(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) GreaterThanOrEqualAny ¶ added in v0.7.1
func (cb *CriteriaBuilder) GreaterThanOrEqualAny(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) GreaterThanOrEqualColumn ¶
func (cb *CriteriaBuilder) GreaterThanOrEqualColumn(column1, column2 string) ConditionBuilder
func (*CriteriaBuilder) GreaterThanOrEqualExpr ¶
func (cb *CriteriaBuilder) GreaterThanOrEqualExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
func (*CriteriaBuilder) GreaterThanOrEqualSubQuery ¶
func (cb *CriteriaBuilder) GreaterThanOrEqualSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) GreaterThanSubQuery ¶
func (cb *CriteriaBuilder) GreaterThanSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) Group ¶
func (cb *CriteriaBuilder) Group(builder func(ConditionBuilder)) ConditionBuilder
func (*CriteriaBuilder) In ¶
func (cb *CriteriaBuilder) In(column string, values any) ConditionBuilder
func (*CriteriaBuilder) InExpr ¶
func (cb *CriteriaBuilder) InExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
func (*CriteriaBuilder) InSubQuery ¶
func (cb *CriteriaBuilder) InSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) IsFalse ¶
func (cb *CriteriaBuilder) IsFalse(column string) ConditionBuilder
func (*CriteriaBuilder) IsFalseExpr ¶
func (cb *CriteriaBuilder) IsFalseExpr(builder func(ExprBuilder) any) ConditionBuilder
func (*CriteriaBuilder) IsFalseSubQuery ¶
func (cb *CriteriaBuilder) IsFalseSubQuery(builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) IsNotNull ¶
func (cb *CriteriaBuilder) IsNotNull(column string) ConditionBuilder
func (*CriteriaBuilder) IsNotNullExpr ¶
func (cb *CriteriaBuilder) IsNotNullExpr(builder func(ExprBuilder) any) ConditionBuilder
func (*CriteriaBuilder) IsNotNullSubQuery ¶
func (cb *CriteriaBuilder) IsNotNullSubQuery(builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) IsNull ¶
func (cb *CriteriaBuilder) IsNull(column string) ConditionBuilder
func (*CriteriaBuilder) IsNullExpr ¶
func (cb *CriteriaBuilder) IsNullExpr(builder func(ExprBuilder) any) ConditionBuilder
func (*CriteriaBuilder) IsNullSubQuery ¶
func (cb *CriteriaBuilder) IsNullSubQuery(builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) IsTrue ¶
func (cb *CriteriaBuilder) IsTrue(column string) ConditionBuilder
func (*CriteriaBuilder) IsTrueExpr ¶
func (cb *CriteriaBuilder) IsTrueExpr(builder func(ExprBuilder) any) ConditionBuilder
IsTrueExpr adds an IS TRUE check for a custom expression.
func (*CriteriaBuilder) IsTrueSubQuery ¶
func (cb *CriteriaBuilder) IsTrueSubQuery(builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) LessThan ¶
func (cb *CriteriaBuilder) LessThan(column string, value any) ConditionBuilder
func (*CriteriaBuilder) LessThanAll ¶ added in v0.7.1
func (cb *CriteriaBuilder) LessThanAll(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) LessThanAny ¶ added in v0.7.1
func (cb *CriteriaBuilder) LessThanAny(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) LessThanColumn ¶
func (cb *CriteriaBuilder) LessThanColumn(column1, column2 string) ConditionBuilder
func (*CriteriaBuilder) LessThanExpr ¶
func (cb *CriteriaBuilder) LessThanExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
func (*CriteriaBuilder) LessThanOrEqual ¶
func (cb *CriteriaBuilder) LessThanOrEqual(column string, value any) ConditionBuilder
func (*CriteriaBuilder) LessThanOrEqualAll ¶ added in v0.7.1
func (cb *CriteriaBuilder) LessThanOrEqualAll(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) LessThanOrEqualAny ¶ added in v0.7.1
func (cb *CriteriaBuilder) LessThanOrEqualAny(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) LessThanOrEqualColumn ¶
func (cb *CriteriaBuilder) LessThanOrEqualColumn(column1, column2 string) ConditionBuilder
func (*CriteriaBuilder) LessThanOrEqualExpr ¶
func (cb *CriteriaBuilder) LessThanOrEqualExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
func (*CriteriaBuilder) LessThanOrEqualSubQuery ¶
func (cb *CriteriaBuilder) LessThanOrEqualSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) LessThanSubQuery ¶
func (cb *CriteriaBuilder) LessThanSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) NotBetween ¶
func (cb *CriteriaBuilder) NotBetween(column string, start, end any) ConditionBuilder
func (*CriteriaBuilder) NotBetweenExpr ¶
func (cb *CriteriaBuilder) NotBetweenExpr(column string, startB, endB func(ExprBuilder) any) ConditionBuilder
func (*CriteriaBuilder) NotContains ¶
func (cb *CriteriaBuilder) NotContains(column, value string) ConditionBuilder
func (*CriteriaBuilder) NotContainsAny ¶
func (cb *CriteriaBuilder) NotContainsAny(column string, values []string) ConditionBuilder
func (*CriteriaBuilder) NotContainsAnyIgnoreCase ¶
func (cb *CriteriaBuilder) NotContainsAnyIgnoreCase(column string, values []string) ConditionBuilder
func (*CriteriaBuilder) NotContainsIgnoreCase ¶
func (cb *CriteriaBuilder) NotContainsIgnoreCase(column, value string) ConditionBuilder
func (*CriteriaBuilder) NotEndsWith ¶
func (cb *CriteriaBuilder) NotEndsWith(column, value string) ConditionBuilder
func (*CriteriaBuilder) NotEndsWithAny ¶
func (cb *CriteriaBuilder) NotEndsWithAny(column string, values []string) ConditionBuilder
func (*CriteriaBuilder) NotEndsWithAnyIgnoreCase ¶
func (cb *CriteriaBuilder) NotEndsWithAnyIgnoreCase(column string, values []string) ConditionBuilder
func (*CriteriaBuilder) NotEndsWithIgnoreCase ¶
func (cb *CriteriaBuilder) NotEndsWithIgnoreCase(column, value string) ConditionBuilder
func (*CriteriaBuilder) NotEquals ¶
func (cb *CriteriaBuilder) NotEquals(column string, value any) ConditionBuilder
func (*CriteriaBuilder) NotEqualsAll ¶ added in v0.7.1
func (cb *CriteriaBuilder) NotEqualsAll(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) NotEqualsAny ¶ added in v0.7.1
func (cb *CriteriaBuilder) NotEqualsAny(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) NotEqualsColumn ¶
func (cb *CriteriaBuilder) NotEqualsColumn(column1, column2 string) ConditionBuilder
func (*CriteriaBuilder) NotEqualsExpr ¶
func (cb *CriteriaBuilder) NotEqualsExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
func (*CriteriaBuilder) NotEqualsSubQuery ¶
func (cb *CriteriaBuilder) NotEqualsSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) NotIn ¶
func (cb *CriteriaBuilder) NotIn(column string, values any) ConditionBuilder
func (*CriteriaBuilder) NotInExpr ¶
func (cb *CriteriaBuilder) NotInExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
func (*CriteriaBuilder) NotInSubQuery ¶
func (cb *CriteriaBuilder) NotInSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) NotStartsWith ¶
func (cb *CriteriaBuilder) NotStartsWith(column, value string) ConditionBuilder
func (*CriteriaBuilder) NotStartsWithAny ¶
func (cb *CriteriaBuilder) NotStartsWithAny(column string, values []string) ConditionBuilder
func (*CriteriaBuilder) NotStartsWithAnyIgnoreCase ¶
func (cb *CriteriaBuilder) NotStartsWithAnyIgnoreCase(column string, values []string) ConditionBuilder
func (*CriteriaBuilder) NotStartsWithIgnoreCase ¶
func (cb *CriteriaBuilder) NotStartsWithIgnoreCase(column, value string) ConditionBuilder
func (*CriteriaBuilder) OrBetween ¶
func (cb *CriteriaBuilder) OrBetween(column string, start, end any) ConditionBuilder
func (*CriteriaBuilder) OrBetweenExpr ¶
func (cb *CriteriaBuilder) OrBetweenExpr(column string, startB, endB func(ExprBuilder) any) ConditionBuilder
func (*CriteriaBuilder) OrContains ¶
func (cb *CriteriaBuilder) OrContains(column, value string) ConditionBuilder
func (*CriteriaBuilder) OrContainsAny ¶
func (cb *CriteriaBuilder) OrContainsAny(column string, values []string) ConditionBuilder
func (*CriteriaBuilder) OrContainsAnyIgnoreCase ¶
func (cb *CriteriaBuilder) OrContainsAnyIgnoreCase(column string, values []string) ConditionBuilder
func (*CriteriaBuilder) OrContainsIgnoreCase ¶
func (cb *CriteriaBuilder) OrContainsIgnoreCase(column, value string) ConditionBuilder
func (*CriteriaBuilder) OrCreatedAtBetween ¶
func (cb *CriteriaBuilder) OrCreatedAtBetween(start, end time.Time, alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrCreatedAtGreaterThan ¶
func (cb *CriteriaBuilder) OrCreatedAtGreaterThan(createdAt time.Time, alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrCreatedAtGreaterThanOrEqual ¶
func (cb *CriteriaBuilder) OrCreatedAtGreaterThanOrEqual(createdAt time.Time, alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrCreatedAtLessThan ¶
func (cb *CriteriaBuilder) OrCreatedAtLessThan(createdAt time.Time, alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrCreatedAtLessThanOrEqual ¶
func (cb *CriteriaBuilder) OrCreatedAtLessThanOrEqual(createdAt time.Time, alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrCreatedAtNotBetween ¶
func (cb *CriteriaBuilder) OrCreatedAtNotBetween(start, end time.Time, alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrCreatedByEquals ¶
func (cb *CriteriaBuilder) OrCreatedByEquals(createdBy string, alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrCreatedByEqualsAll ¶ added in v0.7.1
func (cb *CriteriaBuilder) OrCreatedByEqualsAll(builder func(SelectQuery), alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrCreatedByEqualsAny ¶ added in v0.7.1
func (cb *CriteriaBuilder) OrCreatedByEqualsAny(builder func(SelectQuery), alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrCreatedByEqualsCurrent ¶
func (cb *CriteriaBuilder) OrCreatedByEqualsCurrent(alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrCreatedByEqualsSubQuery ¶
func (cb *CriteriaBuilder) OrCreatedByEqualsSubQuery(builder func(SelectQuery), alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrCreatedByIn ¶
func (cb *CriteriaBuilder) OrCreatedByIn(createdBys []string, alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrCreatedByInSubQuery ¶
func (cb *CriteriaBuilder) OrCreatedByInSubQuery(builder func(SelectQuery), alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrCreatedByNotEquals ¶
func (cb *CriteriaBuilder) OrCreatedByNotEquals(createdBy string, alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrCreatedByNotEqualsAll ¶ added in v0.7.1
func (cb *CriteriaBuilder) OrCreatedByNotEqualsAll(builder func(SelectQuery), alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrCreatedByNotEqualsAny ¶ added in v0.7.1
func (cb *CriteriaBuilder) OrCreatedByNotEqualsAny(builder func(SelectQuery), alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrCreatedByNotEqualsCurrent ¶
func (cb *CriteriaBuilder) OrCreatedByNotEqualsCurrent(alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrCreatedByNotEqualsSubQuery ¶
func (cb *CriteriaBuilder) OrCreatedByNotEqualsSubQuery(builder func(SelectQuery), alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrCreatedByNotIn ¶
func (cb *CriteriaBuilder) OrCreatedByNotIn(createdBys []string, alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrCreatedByNotInSubQuery ¶
func (cb *CriteriaBuilder) OrCreatedByNotInSubQuery(builder func(SelectQuery), alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrEndsWith ¶
func (cb *CriteriaBuilder) OrEndsWith(column, value string) ConditionBuilder
func (*CriteriaBuilder) OrEndsWithAny ¶
func (cb *CriteriaBuilder) OrEndsWithAny(column string, values []string) ConditionBuilder
func (*CriteriaBuilder) OrEndsWithAnyIgnoreCase ¶
func (cb *CriteriaBuilder) OrEndsWithAnyIgnoreCase(column string, values []string) ConditionBuilder
func (*CriteriaBuilder) OrEndsWithIgnoreCase ¶
func (cb *CriteriaBuilder) OrEndsWithIgnoreCase(column, value string) ConditionBuilder
func (*CriteriaBuilder) OrEquals ¶
func (cb *CriteriaBuilder) OrEquals(column string, value any) ConditionBuilder
func (*CriteriaBuilder) OrEqualsAll ¶ added in v0.7.1
func (cb *CriteriaBuilder) OrEqualsAll(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) OrEqualsAny ¶ added in v0.7.1
func (cb *CriteriaBuilder) OrEqualsAny(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) OrEqualsColumn ¶
func (cb *CriteriaBuilder) OrEqualsColumn(column1, column2 string) ConditionBuilder
func (*CriteriaBuilder) OrEqualsExpr ¶
func (cb *CriteriaBuilder) OrEqualsExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
func (*CriteriaBuilder) OrEqualsSubQuery ¶
func (cb *CriteriaBuilder) OrEqualsSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) OrExpr ¶
func (cb *CriteriaBuilder) OrExpr(builder func(ExprBuilder) any) ConditionBuilder
func (*CriteriaBuilder) OrGreaterThan ¶
func (cb *CriteriaBuilder) OrGreaterThan(column string, value any) ConditionBuilder
func (*CriteriaBuilder) OrGreaterThanAll ¶ added in v0.7.1
func (cb *CriteriaBuilder) OrGreaterThanAll(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) OrGreaterThanAny ¶ added in v0.7.1
func (cb *CriteriaBuilder) OrGreaterThanAny(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) OrGreaterThanColumn ¶
func (cb *CriteriaBuilder) OrGreaterThanColumn(column1, column2 string) ConditionBuilder
func (*CriteriaBuilder) OrGreaterThanExpr ¶
func (cb *CriteriaBuilder) OrGreaterThanExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
func (*CriteriaBuilder) OrGreaterThanOrEqual ¶
func (cb *CriteriaBuilder) OrGreaterThanOrEqual(column string, value any) ConditionBuilder
func (*CriteriaBuilder) OrGreaterThanOrEqualAll ¶ added in v0.7.1
func (cb *CriteriaBuilder) OrGreaterThanOrEqualAll(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) OrGreaterThanOrEqualAny ¶ added in v0.7.1
func (cb *CriteriaBuilder) OrGreaterThanOrEqualAny(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) OrGreaterThanOrEqualColumn ¶
func (cb *CriteriaBuilder) OrGreaterThanOrEqualColumn(column1, column2 string) ConditionBuilder
func (*CriteriaBuilder) OrGreaterThanOrEqualExpr ¶
func (cb *CriteriaBuilder) OrGreaterThanOrEqualExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
func (*CriteriaBuilder) OrGreaterThanOrEqualSubQuery ¶
func (cb *CriteriaBuilder) OrGreaterThanOrEqualSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) OrGreaterThanSubQuery ¶
func (cb *CriteriaBuilder) OrGreaterThanSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) OrGroup ¶
func (cb *CriteriaBuilder) OrGroup(builder func(ConditionBuilder)) ConditionBuilder
func (*CriteriaBuilder) OrIn ¶
func (cb *CriteriaBuilder) OrIn(column string, values any) ConditionBuilder
func (*CriteriaBuilder) OrInExpr ¶
func (cb *CriteriaBuilder) OrInExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
func (*CriteriaBuilder) OrInSubQuery ¶
func (cb *CriteriaBuilder) OrInSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) OrIsFalse ¶
func (cb *CriteriaBuilder) OrIsFalse(column string) ConditionBuilder
func (*CriteriaBuilder) OrIsFalseExpr ¶
func (cb *CriteriaBuilder) OrIsFalseExpr(builder func(ExprBuilder) any) ConditionBuilder
func (*CriteriaBuilder) OrIsFalseSubQuery ¶
func (cb *CriteriaBuilder) OrIsFalseSubQuery(builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) OrIsNotNull ¶
func (cb *CriteriaBuilder) OrIsNotNull(column string) ConditionBuilder
func (*CriteriaBuilder) OrIsNotNullExpr ¶
func (cb *CriteriaBuilder) OrIsNotNullExpr(builder func(ExprBuilder) any) ConditionBuilder
func (*CriteriaBuilder) OrIsNotNullSubQuery ¶
func (cb *CriteriaBuilder) OrIsNotNullSubQuery(builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) OrIsNull ¶
func (cb *CriteriaBuilder) OrIsNull(column string) ConditionBuilder
func (*CriteriaBuilder) OrIsNullExpr ¶
func (cb *CriteriaBuilder) OrIsNullExpr(builder func(ExprBuilder) any) ConditionBuilder
func (*CriteriaBuilder) OrIsNullSubQuery ¶
func (cb *CriteriaBuilder) OrIsNullSubQuery(builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) OrIsTrue ¶
func (cb *CriteriaBuilder) OrIsTrue(column string) ConditionBuilder
func (*CriteriaBuilder) OrIsTrueExpr ¶
func (cb *CriteriaBuilder) OrIsTrueExpr(builder func(ExprBuilder) any) ConditionBuilder
OrIsTrueExpr adds an OR IS TRUE check for a custom expression.
func (*CriteriaBuilder) OrIsTrueSubQuery ¶
func (cb *CriteriaBuilder) OrIsTrueSubQuery(builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) OrLessThan ¶
func (cb *CriteriaBuilder) OrLessThan(column string, value any) ConditionBuilder
func (*CriteriaBuilder) OrLessThanAll ¶ added in v0.7.1
func (cb *CriteriaBuilder) OrLessThanAll(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) OrLessThanAny ¶ added in v0.7.1
func (cb *CriteriaBuilder) OrLessThanAny(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) OrLessThanColumn ¶
func (cb *CriteriaBuilder) OrLessThanColumn(column1, column2 string) ConditionBuilder
func (*CriteriaBuilder) OrLessThanExpr ¶
func (cb *CriteriaBuilder) OrLessThanExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
func (*CriteriaBuilder) OrLessThanOrEqual ¶
func (cb *CriteriaBuilder) OrLessThanOrEqual(column string, value any) ConditionBuilder
func (*CriteriaBuilder) OrLessThanOrEqualAll ¶ added in v0.7.1
func (cb *CriteriaBuilder) OrLessThanOrEqualAll(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) OrLessThanOrEqualAny ¶ added in v0.7.1
func (cb *CriteriaBuilder) OrLessThanOrEqualAny(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) OrLessThanOrEqualColumn ¶
func (cb *CriteriaBuilder) OrLessThanOrEqualColumn(column1, column2 string) ConditionBuilder
func (*CriteriaBuilder) OrLessThanOrEqualExpr ¶
func (cb *CriteriaBuilder) OrLessThanOrEqualExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
func (*CriteriaBuilder) OrLessThanOrEqualSubQuery ¶
func (cb *CriteriaBuilder) OrLessThanOrEqualSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) OrLessThanSubQuery ¶
func (cb *CriteriaBuilder) OrLessThanSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) OrNotBetween ¶
func (cb *CriteriaBuilder) OrNotBetween(column string, start, end any) ConditionBuilder
func (*CriteriaBuilder) OrNotBetweenExpr ¶
func (cb *CriteriaBuilder) OrNotBetweenExpr(column string, startB, endB func(ExprBuilder) any) ConditionBuilder
func (*CriteriaBuilder) OrNotContains ¶
func (cb *CriteriaBuilder) OrNotContains(column, value string) ConditionBuilder
func (*CriteriaBuilder) OrNotContainsAny ¶
func (cb *CriteriaBuilder) OrNotContainsAny(column string, values []string) ConditionBuilder
func (*CriteriaBuilder) OrNotContainsAnyIgnoreCase ¶
func (cb *CriteriaBuilder) OrNotContainsAnyIgnoreCase(column string, values []string) ConditionBuilder
func (*CriteriaBuilder) OrNotContainsIgnoreCase ¶
func (cb *CriteriaBuilder) OrNotContainsIgnoreCase(column, value string) ConditionBuilder
func (*CriteriaBuilder) OrNotEndsWith ¶
func (cb *CriteriaBuilder) OrNotEndsWith(column, value string) ConditionBuilder
func (*CriteriaBuilder) OrNotEndsWithAny ¶
func (cb *CriteriaBuilder) OrNotEndsWithAny(column string, values []string) ConditionBuilder
func (*CriteriaBuilder) OrNotEndsWithAnyIgnoreCase ¶
func (cb *CriteriaBuilder) OrNotEndsWithAnyIgnoreCase(column string, values []string) ConditionBuilder
func (*CriteriaBuilder) OrNotEndsWithIgnoreCase ¶
func (cb *CriteriaBuilder) OrNotEndsWithIgnoreCase(column, value string) ConditionBuilder
func (*CriteriaBuilder) OrNotEquals ¶
func (cb *CriteriaBuilder) OrNotEquals(column string, value any) ConditionBuilder
func (*CriteriaBuilder) OrNotEqualsAll ¶ added in v0.7.1
func (cb *CriteriaBuilder) OrNotEqualsAll(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) OrNotEqualsAny ¶ added in v0.7.1
func (cb *CriteriaBuilder) OrNotEqualsAny(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) OrNotEqualsColumn ¶
func (cb *CriteriaBuilder) OrNotEqualsColumn(column1, column2 string) ConditionBuilder
func (*CriteriaBuilder) OrNotEqualsExpr ¶
func (cb *CriteriaBuilder) OrNotEqualsExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
func (*CriteriaBuilder) OrNotEqualsSubQuery ¶
func (cb *CriteriaBuilder) OrNotEqualsSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) OrNotIn ¶
func (cb *CriteriaBuilder) OrNotIn(column string, values any) ConditionBuilder
func (*CriteriaBuilder) OrNotInExpr ¶
func (cb *CriteriaBuilder) OrNotInExpr(column string, builder func(ExprBuilder) any) ConditionBuilder
func (*CriteriaBuilder) OrNotInSubQuery ¶
func (cb *CriteriaBuilder) OrNotInSubQuery(column string, builder func(query SelectQuery)) ConditionBuilder
func (*CriteriaBuilder) OrNotStartsWith ¶
func (cb *CriteriaBuilder) OrNotStartsWith(column, value string) ConditionBuilder
func (*CriteriaBuilder) OrNotStartsWithAny ¶
func (cb *CriteriaBuilder) OrNotStartsWithAny(column string, values []string) ConditionBuilder
func (*CriteriaBuilder) OrNotStartsWithAnyIgnoreCase ¶
func (cb *CriteriaBuilder) OrNotStartsWithAnyIgnoreCase(column string, values []string) ConditionBuilder
func (*CriteriaBuilder) OrNotStartsWithIgnoreCase ¶
func (cb *CriteriaBuilder) OrNotStartsWithIgnoreCase(column, value string) ConditionBuilder
func (*CriteriaBuilder) OrPKEquals ¶
func (cb *CriteriaBuilder) OrPKEquals(pk any, alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrPKIn ¶
func (cb *CriteriaBuilder) OrPKIn(pks any, alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrPKNotEquals ¶
func (cb *CriteriaBuilder) OrPKNotEquals(pk any, alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrPKNotIn ¶
func (cb *CriteriaBuilder) OrPKNotIn(pks any, alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrStartsWith ¶
func (cb *CriteriaBuilder) OrStartsWith(column, value string) ConditionBuilder
func (*CriteriaBuilder) OrStartsWithAny ¶
func (cb *CriteriaBuilder) OrStartsWithAny(column string, values []string) ConditionBuilder
func (*CriteriaBuilder) OrStartsWithAnyIgnoreCase ¶
func (cb *CriteriaBuilder) OrStartsWithAnyIgnoreCase(column string, values []string) ConditionBuilder
func (*CriteriaBuilder) OrStartsWithIgnoreCase ¶
func (cb *CriteriaBuilder) OrStartsWithIgnoreCase(column, value string) ConditionBuilder
func (*CriteriaBuilder) OrUpdatedAtBetween ¶
func (cb *CriteriaBuilder) OrUpdatedAtBetween(start, end time.Time, alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrUpdatedAtGreaterThan ¶
func (cb *CriteriaBuilder) OrUpdatedAtGreaterThan(updatedAt time.Time, alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrUpdatedAtGreaterThanOrEqual ¶
func (cb *CriteriaBuilder) OrUpdatedAtGreaterThanOrEqual(updatedAt time.Time, alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrUpdatedAtLessThan ¶
func (cb *CriteriaBuilder) OrUpdatedAtLessThan(updatedAt time.Time, alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrUpdatedAtLessThanOrEqual ¶
func (cb *CriteriaBuilder) OrUpdatedAtLessThanOrEqual(updatedAt time.Time, alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrUpdatedAtNotBetween ¶
func (cb *CriteriaBuilder) OrUpdatedAtNotBetween(start, end time.Time, alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrUpdatedByEquals ¶
func (cb *CriteriaBuilder) OrUpdatedByEquals(updatedBy string, alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrUpdatedByEqualsAll ¶ added in v0.7.1
func (cb *CriteriaBuilder) OrUpdatedByEqualsAll(builder func(SelectQuery), alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrUpdatedByEqualsAny ¶ added in v0.7.1
func (cb *CriteriaBuilder) OrUpdatedByEqualsAny(builder func(SelectQuery), alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrUpdatedByEqualsCurrent ¶
func (cb *CriteriaBuilder) OrUpdatedByEqualsCurrent(alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrUpdatedByEqualsSubQuery ¶
func (cb *CriteriaBuilder) OrUpdatedByEqualsSubQuery(builder func(SelectQuery), alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrUpdatedByIn ¶
func (cb *CriteriaBuilder) OrUpdatedByIn(updatedBys []string, alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrUpdatedByInSubQuery ¶
func (cb *CriteriaBuilder) OrUpdatedByInSubQuery(builder func(SelectQuery), alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrUpdatedByNotEquals ¶
func (cb *CriteriaBuilder) OrUpdatedByNotEquals(updatedBy string, alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrUpdatedByNotEqualsAll ¶ added in v0.7.1
func (cb *CriteriaBuilder) OrUpdatedByNotEqualsAll(builder func(SelectQuery), alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrUpdatedByNotEqualsAny ¶ added in v0.7.1
func (cb *CriteriaBuilder) OrUpdatedByNotEqualsAny(builder func(SelectQuery), alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrUpdatedByNotEqualsCurrent ¶
func (cb *CriteriaBuilder) OrUpdatedByNotEqualsCurrent(alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrUpdatedByNotEqualsSubQuery ¶
func (cb *CriteriaBuilder) OrUpdatedByNotEqualsSubQuery(builder func(SelectQuery), alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrUpdatedByNotIn ¶
func (cb *CriteriaBuilder) OrUpdatedByNotIn(updatedBys []string, alias ...string) ConditionBuilder
func (*CriteriaBuilder) OrUpdatedByNotInSubQuery ¶
func (cb *CriteriaBuilder) OrUpdatedByNotInSubQuery(builder func(SelectQuery), alias ...string) ConditionBuilder
func (*CriteriaBuilder) PKEquals ¶
func (cb *CriteriaBuilder) PKEquals(pk any, alias ...string) ConditionBuilder
func (*CriteriaBuilder) PKIn ¶
func (cb *CriteriaBuilder) PKIn(pks any, alias ...string) ConditionBuilder
func (*CriteriaBuilder) PKNotEquals ¶
func (cb *CriteriaBuilder) PKNotEquals(pk any, alias ...string) ConditionBuilder
func (*CriteriaBuilder) PKNotIn ¶
func (cb *CriteriaBuilder) PKNotIn(pks any, alias ...string) ConditionBuilder
func (*CriteriaBuilder) StartsWith ¶
func (cb *CriteriaBuilder) StartsWith(column, value string) ConditionBuilder
func (*CriteriaBuilder) StartsWithAny ¶
func (cb *CriteriaBuilder) StartsWithAny(column string, values []string) ConditionBuilder
func (*CriteriaBuilder) StartsWithAnyIgnoreCase ¶
func (cb *CriteriaBuilder) StartsWithAnyIgnoreCase(column string, values []string) ConditionBuilder
func (*CriteriaBuilder) StartsWithIgnoreCase ¶
func (cb *CriteriaBuilder) StartsWithIgnoreCase(column, value string) ConditionBuilder
func (*CriteriaBuilder) UpdatedAtBetween ¶
func (cb *CriteriaBuilder) UpdatedAtBetween(start, end time.Time, alias ...string) ConditionBuilder
func (*CriteriaBuilder) UpdatedAtGreaterThan ¶
func (cb *CriteriaBuilder) UpdatedAtGreaterThan(updatedAt time.Time, alias ...string) ConditionBuilder
func (*CriteriaBuilder) UpdatedAtGreaterThanOrEqual ¶
func (cb *CriteriaBuilder) UpdatedAtGreaterThanOrEqual(updatedAt time.Time, alias ...string) ConditionBuilder
func (*CriteriaBuilder) UpdatedAtLessThan ¶
func (cb *CriteriaBuilder) UpdatedAtLessThan(updatedAt time.Time, alias ...string) ConditionBuilder
func (*CriteriaBuilder) UpdatedAtLessThanOrEqual ¶
func (cb *CriteriaBuilder) UpdatedAtLessThanOrEqual(updatedAt time.Time, alias ...string) ConditionBuilder
func (*CriteriaBuilder) UpdatedAtNotBetween ¶
func (cb *CriteriaBuilder) UpdatedAtNotBetween(start, end time.Time, alias ...string) ConditionBuilder
func (*CriteriaBuilder) UpdatedByEquals ¶
func (cb *CriteriaBuilder) UpdatedByEquals(updatedBy string, alias ...string) ConditionBuilder
func (*CriteriaBuilder) UpdatedByEqualsAll ¶ added in v0.7.1
func (cb *CriteriaBuilder) UpdatedByEqualsAll(builder func(SelectQuery), alias ...string) ConditionBuilder
func (*CriteriaBuilder) UpdatedByEqualsAny ¶ added in v0.7.1
func (cb *CriteriaBuilder) UpdatedByEqualsAny(builder func(SelectQuery), alias ...string) ConditionBuilder
func (*CriteriaBuilder) UpdatedByEqualsCurrent ¶
func (cb *CriteriaBuilder) UpdatedByEqualsCurrent(alias ...string) ConditionBuilder
func (*CriteriaBuilder) UpdatedByEqualsSubQuery ¶
func (cb *CriteriaBuilder) UpdatedByEqualsSubQuery(builder func(SelectQuery), alias ...string) ConditionBuilder
func (*CriteriaBuilder) UpdatedByIn ¶
func (cb *CriteriaBuilder) UpdatedByIn(updatedBys []string, alias ...string) ConditionBuilder
func (*CriteriaBuilder) UpdatedByInSubQuery ¶
func (cb *CriteriaBuilder) UpdatedByInSubQuery(builder func(SelectQuery), alias ...string) ConditionBuilder
func (*CriteriaBuilder) UpdatedByNotEquals ¶
func (cb *CriteriaBuilder) UpdatedByNotEquals(updatedBy string, alias ...string) ConditionBuilder
func (*CriteriaBuilder) UpdatedByNotEqualsAll ¶ added in v0.7.1
func (cb *CriteriaBuilder) UpdatedByNotEqualsAll(builder func(SelectQuery), alias ...string) ConditionBuilder
func (*CriteriaBuilder) UpdatedByNotEqualsAny ¶ added in v0.7.1
func (cb *CriteriaBuilder) UpdatedByNotEqualsAny(builder func(SelectQuery), alias ...string) ConditionBuilder
func (*CriteriaBuilder) UpdatedByNotEqualsCurrent ¶
func (cb *CriteriaBuilder) UpdatedByNotEqualsCurrent(alias ...string) ConditionBuilder
func (*CriteriaBuilder) UpdatedByNotEqualsSubQuery ¶
func (cb *CriteriaBuilder) UpdatedByNotEqualsSubQuery(builder func(SelectQuery), alias ...string) ConditionBuilder
func (*CriteriaBuilder) UpdatedByNotIn ¶
func (cb *CriteriaBuilder) UpdatedByNotIn(updatedBys []string, alias ...string) ConditionBuilder
func (*CriteriaBuilder) UpdatedByNotInSubQuery ¶
func (cb *CriteriaBuilder) UpdatedByNotInSubQuery(builder func(SelectQuery), alias ...string) ConditionBuilder
type CumeDistBuilder ¶
type CumeDistBuilder interface {
WindowPartitionable[WindowFrameablePartitionBuilder]
}
CumeDistBuilder defines the CUME_DIST() window function builder.
type DB ¶ added in v0.18.0
type DB interface {
// NewSelect creates a new select query.
NewSelect() SelectQuery
// NewInsert creates a new insert.
NewInsert() InsertQuery
// NewUpdate creates a new update.
NewUpdate() UpdateQuery
// NewDelete creates a new delete.
NewDelete() DeleteQuery
// NewMerge creates a new merge query.
NewMerge() MergeQuery
// NewRaw creates a new raw query.
NewRaw(query string, args ...any) RawQuery
// RunInTX runs a transaction.
RunInTX(ctx context.Context, fn func(ctx context.Context, tx DB) error) error
// RunInReadOnlyTX runs a read-only transaction.
RunInReadOnlyTX(ctx context.Context, fn func(ctx context.Context, tx DB) error) error
// WithNamedArg returns a new DB with the named arg.
WithNamedArg(name string, value any) DB
// ModelPKs returns the primary keys of a model.
ModelPKs(model any) (map[string]any, error)
// ModelPKFields returns the primary key fields of a model.
ModelPKFields(model any) []*PKField
// TableOf returns the table information for a model.
TableOf(model any) *schema.Table
}
DB is an interface that defines the methods for database operations. It provides factory methods for creating different types of queries and supports transactions.
type DBAccessor ¶ added in v0.18.0
type DBAccessor interface {
// DB returns the underlying DB instance.
DB() DB
}
DBAccessor provides access to the underlying DB instance.
type DateTimeUnit ¶ added in v0.14.0
type DateTimeUnit int
DateTimeUnit represents date and time interval units for date arithmetic operations.
const ( UnitYear DateTimeUnit = iota UnitMonth UnitDay UnitHour UnitMinute UnitSecond )
func (DateTimeUnit) ForDateTrunc ¶ added in v0.14.0
func (u DateTimeUnit) ForDateTrunc() string
ForDateTrunc returns the lowercase string for DateTrunc precision parameter.
func (DateTimeUnit) ForMySQL ¶ added in v0.14.0
func (u DateTimeUnit) ForMySQL() string
ForMySQL returns the MySQL interval unit string (YEAR, MONTH, DAY, etc.).
func (DateTimeUnit) ForPostgres ¶ added in v0.14.0
func (u DateTimeUnit) ForPostgres() string
ForPostgres returns the PostgreSQL interval unit string (YEAR, MONTH, DAY, etc.).
func (DateTimeUnit) ForSQLite ¶ added in v0.14.0
func (u DateTimeUnit) ForSQLite() string
ForSQLite returns the SQLite datetime modifier string (years, months, days, etc.).
func (DateTimeUnit) String ¶ added in v0.14.0
func (u DateTimeUnit) String() string
type DeleteQuery ¶
type DeleteQuery interface {
QueryBuilder
QueryExecutor
DBAccessor
CTE[DeleteQuery]
TableSource[DeleteQuery]
Filterable[DeleteQuery]
Orderable[DeleteQuery]
Limitable[DeleteQuery]
Returnable[DeleteQuery]
Applier[DeleteQuery]
// ForceDelete adds a force delete clause to the query.
ForceDelete() DeleteQuery
}
DeleteQuery is an interface that defines the methods for building and executing DELETE queries. It supports USING clause for joining additional tables, conditions, ordering, limits, and soft delete operations.
type DenseRankBuilder ¶
type DenseRankBuilder interface {
WindowPartitionable[WindowFrameablePartitionBuilder]
}
DenseRankBuilder defines the DENSE_RANK() window function builder.
type DialectActionErr ¶
type DialectActionErr func() error
DialectActionErr represents a zero-argument callback that can return an error.
type DialectExecs ¶ added in v0.7.1
type DialectExecs struct {
// Oracle callback for Oracle database.
Oracle DialectAction
// SQL Server callback for SQL Server database.
SQLServer DialectAction
// Postgres callback for PostgreSQL database.
Postgres DialectAction
// MySQL callback for MySQL database.
MySQL DialectAction
// SQLite callback for SQLite database.
SQLite DialectAction
// Default callback used when database-specific callback is not available.
Default DialectAction
}
DialectExecs defines database-specific callbacks for running side-effect logic without returning a SQL expression.
type DialectExecsWithErr ¶ added in v0.7.1
type DialectExecsWithErr struct {
// Oracle callback for Oracle database.
Oracle DialectActionErr
// SQL Server callback for SQL Server database.
SQLServer DialectActionErr
// Postgres callback for PostgreSQL database.
Postgres DialectActionErr
// MySQL callback for MySQL database.
MySQL DialectActionErr
// SQLite callback for SQLite database.
SQLite DialectActionErr
// Default callback used when database-specific callback is not available.
Default DialectActionErr
}
DialectExecsWithErr defines database-specific callbacks that may return an error.
type DialectExprBuilder ¶
type DialectExprBuilder func() schema.QueryAppender
DialectExprBuilder represents a zero-argument callback that returns a QueryAppender.
type DialectExprs ¶ added in v0.7.1
type DialectExprs struct {
// Oracle expression builder for Oracle database.
Oracle DialectExprBuilder
// SQL Server expression builder for SQL Server database.
SQLServer DialectExprBuilder
// Postgres expression builder for PostgreSQL database.
Postgres DialectExprBuilder
// MySQL expression builder for MySQL database.
MySQL DialectExprBuilder
// SQLite expression builder for SQLite database.
SQLite DialectExprBuilder
// Default expression builder used when database-specific builder is not available.
Default DialectExprBuilder
}
DialectExprs defines database-specific expression builders for cross-database compatibility. It allows users to define custom expressions that work across different database engines by providing database-specific implementations.
type DialectFragmentBuilder ¶ added in v0.7.1
DialectFragmentBuilder represents a zero-argument callback that returns a query fragment buffer.
type DialectFragments ¶ added in v0.7.1
type DialectFragments struct {
// Oracle callback for Oracle database.
Oracle DialectFragmentBuilder
// SQL Server callback for SQL Server database.
SQLServer DialectFragmentBuilder
// Postgres callback for PostgreSQL database.
Postgres DialectFragmentBuilder
// MySQL callback for MySQL database.
MySQL DialectFragmentBuilder
// SQLite callback for SQLite database.
SQLite DialectFragmentBuilder
// Default callback used when database-specific callback is not available.
Default DialectFragmentBuilder
}
DialectFragments defines database-specific callbacks that produce query fragments.
type DistinctableAggregate ¶
type DistinctableAggregate[T any] interface { // Distinct marks the aggregate to operate on DISTINCT values. Distinct() T }
DistinctableAggregate defines aggregate functions that support DISTINCT operations.
type ExprBuilder ¶
type ExprBuilder interface {
// Column builds a column expression with proper alias handling.
// If withTableAlias is false, skips automatic table alias addition even when table exists.
Column(column string, withTableAlias ...bool) schema.QueryAppender
// TableColumns returns a table columns expression (?TableColumns or ?Columns).
TableColumns(withTableAlias ...bool) schema.QueryAppender
// AllColumns returns a wildcard column expression for all columns.
AllColumns(tableAlias ...string) schema.QueryAppender
// Null returns the NULL SQL literal.
Null() schema.QueryAppender
// IsNull checks if an expression is NULL.
IsNull(expr any) schema.QueryAppender
// IsNotNull checks if an expression is not NULL.
IsNotNull(expr any) schema.QueryAppender
// Literal builds a literal expression.
Literal(value any) schema.QueryAppender
// Order builds an ORDER BY expression.
Order(func(OrderBuilder)) schema.QueryAppender
// Case creates a CASE expression builder for conditional logic.
Case(func(CaseBuilder)) schema.QueryAppender
// SubQuery creates a subquery expression for use in larger queries.
SubQuery(func(SelectQuery)) schema.QueryAppender
// Exists creates an EXISTS subquery expression.
Exists(func(SelectQuery)) schema.QueryAppender
// NotExists creates a NOT EXISTS subquery expression.
NotExists(func(SelectQuery)) schema.QueryAppender
// Paren wraps an expression in parentheses.
Paren(expr any) schema.QueryAppender
// Not creates a negation expression (NOT expr).
Not(expr any) schema.QueryAppender
// Any wraps a subquery with the ANY operator.
Any(func(SelectQuery)) schema.QueryAppender
// All wraps a subquery with the ALL operator.
All(func(SelectQuery)) schema.QueryAppender
// Add creates an addition expression (left + right).
Add(left, right any) schema.QueryAppender
// Subtract creates a subtraction expression (left - right).
Subtract(left, right any) schema.QueryAppender
// Multiply creates a multiplication expression (left * right).
Multiply(left, right any) schema.QueryAppender
// Divide creates a division expression (left / right).
Divide(left, right any) schema.QueryAppender
// Equals creates an equality comparison expression (left = right).
Equals(left, right any) schema.QueryAppender
// NotEquals creates an inequality comparison expression (left <> right).
NotEquals(left, right any) schema.QueryAppender
// GreaterThan creates a greater-than comparison expression (left > right).
GreaterThan(left, right any) schema.QueryAppender
// GreaterThanOrEqual creates a greater-than-or-equal comparison expression (left >= right).
GreaterThanOrEqual(left, right any) schema.QueryAppender
// LessThan creates a less-than comparison expression (left < right).
LessThan(left, right any) schema.QueryAppender
// LessThanOrEqual creates a less-than-or-equal comparison expression (left <= right).
LessThanOrEqual(left, right any) schema.QueryAppender
// Between creates a between comparison expression (expr BETWEEN lower AND upper).
Between(expr, lower, upper any) schema.QueryAppender
// NotBetween creates a not between comparison expression (expr NOT BETWEEN lower AND upper).
NotBetween(expr, lower, upper any) schema.QueryAppender
// In creates an IN comparison expression (expr IN (values...)).
In(expr any, values ...any) schema.QueryAppender
// NotIn creates a NOT IN comparison expression (expr NOT IN (values...)).
NotIn(expr any, values ...any) schema.QueryAppender
// IsTrue checks if a boolean expression is TRUE.
IsTrue(expr any) schema.QueryAppender
// IsFalse checks if a boolean expression is FALSE.
IsFalse(expr any) schema.QueryAppender
// Expr creates an expression builder for complex SQL logic.
Expr(expr string, args ...any) schema.QueryAppender
// Exprs creates an expression builder for complex SQL logic.
Exprs(exprs ...any) schema.QueryAppender
// ExprsWithSep creates an expression builder for complex SQL logic with a separator.
ExprsWithSep(separator any, exprs ...any) schema.QueryAppender
// ExprByDialect creates a cross-database compatible expression.
// It selects the appropriate expression builder based on the current database dialect.
ExprByDialect(exprs DialectExprs) schema.QueryAppender
// ExecByDialect selects the appropriate callback based on the current database dialect.
ExecByDialect(execs DialectExecs)
// ExecByDialectWithErr runs dialect-specific callbacks and returns any error encountered.
ExecByDialectWithErr(execs DialectExecsWithErr) error
// FragmentByDialect selects the appropriate query fragment builder based on the current database dialect.
FragmentByDialect(fragments DialectFragments) ([]byte, error)
// Count builds a COUNT aggregate expression using a builder callback.
Count(func(CountBuilder)) schema.QueryAppender
// CountColumn builds a COUNT(column) aggregate expression.
CountColumn(column string, distinct ...bool) schema.QueryAppender
// CountAll builds a COUNT(*) aggregate expression.
CountAll(distinct ...bool) schema.QueryAppender
// Sum builds a SUM aggregate expression using a builder callback.
Sum(func(SumBuilder)) schema.QueryAppender
// SumColumn builds a SUM(column) aggregate expression.
SumColumn(column string, distinct ...bool) schema.QueryAppender
// Avg builds an AVG aggregate expression using a builder callback.
Avg(func(AvgBuilder)) schema.QueryAppender
// AvgColumn builds an AVG(column) aggregate expression.
AvgColumn(column string, distinct ...bool) schema.QueryAppender
// Min builds a MIN aggregate expression using a builder callback.
Min(func(MinBuilder)) schema.QueryAppender
// MinColumn builds a MIN(column) aggregate expression.
MinColumn(column string) schema.QueryAppender
// Max builds a MAX aggregate expression using a builder callback.
Max(func(MaxBuilder)) schema.QueryAppender
// MaxColumn builds a MAX(column) aggregate expression.
MaxColumn(column string) schema.QueryAppender
// StringAgg builds a STRING_AGG aggregate expression using a builder callback.
StringAgg(func(StringAggBuilder)) schema.QueryAppender
// ArrayAgg builds an ARRAY_AGG aggregate expression using a builder callback.
ArrayAgg(func(ArrayAggBuilder)) schema.QueryAppender
// JSONObjectAgg builds a JSON_OBJECT_AGG aggregate expression using a builder callback.
JSONObjectAgg(func(JSONObjectAggBuilder)) schema.QueryAppender
// JSONArrayAgg builds a JSON_ARRAY_AGG aggregate expression using a builder callback.
JSONArrayAgg(func(JSONArrayAggBuilder)) schema.QueryAppender
// BitOr builds a BIT_OR aggregate expression using a builder callback.
BitOr(func(BitOrBuilder)) schema.QueryAppender
// BitAnd builds a BIT_AND aggregate expression using a builder callback.
BitAnd(func(BitAndBuilder)) schema.QueryAppender
// BoolOr builds a BOOL_OR aggregate expression using a builder callback.
BoolOr(func(BoolOrBuilder)) schema.QueryAppender
// BoolAnd builds a BOOL_AND aggregate expression using a builder callback.
BoolAnd(func(BoolAndBuilder)) schema.QueryAppender
// StdDev builds a STDDEV aggregate expression using a builder callback.
StdDev(func(StdDevBuilder)) schema.QueryAppender
// Variance builds a VARIANCE aggregate expression using a builder callback.
Variance(func(VarianceBuilder)) schema.QueryAppender
// RowNumber builds a ROW_NUMBER window function expression.
RowNumber(func(RowNumberBuilder)) schema.QueryAppender
// Rank builds a RANK window function expression.
Rank(func(RankBuilder)) schema.QueryAppender
// DenseRank builds a DENSE_RANK window function expression.
DenseRank(func(DenseRankBuilder)) schema.QueryAppender
// PercentRank builds a PERCENT_RANK window function expression.
PercentRank(func(PercentRankBuilder)) schema.QueryAppender
// CumeDist builds a CUME_DIST window function expression.
CumeDist(func(CumeDistBuilder)) schema.QueryAppender
// NTile builds an NTILE window function expression.
NTile(func(NTileBuilder)) schema.QueryAppender
// Lag builds a LAG window function expression.
Lag(func(LagBuilder)) schema.QueryAppender
// Lead builds a LEAD window function expression.
Lead(func(LeadBuilder)) schema.QueryAppender
// FirstValue builds a FIRST_VALUE window function expression.
FirstValue(func(FirstValueBuilder)) schema.QueryAppender
// LastValue builds a LAST_VALUE window function expression.
LastValue(func(LastValueBuilder)) schema.QueryAppender
// NthValue builds an NTH_VALUE window function expression.
NthValue(func(NthValueBuilder)) schema.QueryAppender
// WinCount builds a COUNT window function expression.
WinCount(func(WindowCountBuilder)) schema.QueryAppender
// WinSum builds a SUM window function expression.
WinSum(func(WindowSumBuilder)) schema.QueryAppender
// WinAvg builds an AVG window function expression.
WinAvg(func(WindowAvgBuilder)) schema.QueryAppender
// WinMin builds a MIN window function expression.
WinMin(func(WindowMinBuilder)) schema.QueryAppender
// WinMax builds a MAX window function expression.
WinMax(func(WindowMaxBuilder)) schema.QueryAppender
// WinStringAgg builds a STRING_AGG window function expression.
WinStringAgg(func(WindowStringAggBuilder)) schema.QueryAppender
// WinArrayAgg builds an ARRAY_AGG window function expression.
WinArrayAgg(func(WindowArrayAggBuilder)) schema.QueryAppender
// WinStdDev builds a STDDEV window function expression.
WinStdDev(func(WindowStdDevBuilder)) schema.QueryAppender
// WinVariance builds a VARIANCE window function expression.
WinVariance(func(WindowVarianceBuilder)) schema.QueryAppender
// WinJSONObjectAgg builds a JSON_OBJECT_AGG window function expression.
WinJSONObjectAgg(func(WindowJSONObjectAggBuilder)) schema.QueryAppender
// WinJSONArrayAgg builds a JSON_ARRAY_AGG window function expression.
WinJSONArrayAgg(func(WindowJSONArrayAggBuilder)) schema.QueryAppender
// WinBitOr builds a BIT_OR window function expression.
WinBitOr(func(WindowBitOrBuilder)) schema.QueryAppender
// WinBitAnd builds a BIT_AND window function expression.
WinBitAnd(func(WindowBitAndBuilder)) schema.QueryAppender
// WinBoolOr builds a BOOL_OR window function expression.
WinBoolOr(func(WindowBoolOrBuilder)) schema.QueryAppender
// WinBoolAnd builds a BOOL_AND window function expression.
WinBoolAnd(func(WindowBoolAndBuilder)) schema.QueryAppender
// Concat concatenates strings.
Concat(args ...any) schema.QueryAppender
// ConcatWithSep concatenates strings with a separator.
ConcatWithSep(separator any, args ...any) schema.QueryAppender
// SubString extracts a substring from a string.
// start: starting position (1-based), length: optional length
SubString(expr, start any, length ...any) schema.QueryAppender
// Upper converts string to uppercase.
Upper(expr any) schema.QueryAppender
// Lower converts string to lowercase.
Lower(expr any) schema.QueryAppender
// Trim removes leading and trailing whitespace.
Trim(expr any) schema.QueryAppender
// TrimLeft removes leading whitespace.
TrimLeft(expr any) schema.QueryAppender
// TrimRight removes trailing whitespace.
TrimRight(expr any) schema.QueryAppender
// Length returns the length of a string.
Length(expr any) schema.QueryAppender
// CharLength returns the character length of a string.
CharLength(expr any) schema.QueryAppender
// Position finds the position of substring in string (1-based, 0 if not found).
Position(substring, str any) schema.QueryAppender
// Left returns the leftmost n characters.
Left(expr, length any) schema.QueryAppender
// Right returns the rightmost n characters.
Right(expr, length any) schema.QueryAppender
// Repeat repeats a string n times.
Repeat(expr, count any) schema.QueryAppender
// Replace replaces all occurrences of substring with replacement.
Replace(expr, search, replacement any) schema.QueryAppender
// Contains checks if a string contains a substring (case-sensitive).
Contains(expr, substr any) schema.QueryAppender
// StartsWith checks if a string starts with a prefix (case-sensitive).
StartsWith(expr, prefix any) schema.QueryAppender
// EndsWith checks if a string ends with a suffix (case-sensitive).
EndsWith(expr, suffix any) schema.QueryAppender
// ContainsIgnoreCase checks if a string contains a substring (case-insensitive).
ContainsIgnoreCase(expr, substr any) schema.QueryAppender
// StartsWithIgnoreCase checks if a string starts with a prefix (case-insensitive).
StartsWithIgnoreCase(expr, prefix any) schema.QueryAppender
// EndsWithIgnoreCase checks if a string ends with a suffix (case-insensitive).
EndsWithIgnoreCase(expr, suffix any) schema.QueryAppender
// Reverse reverses a string.
Reverse(expr any) schema.QueryAppender
// CurrentDate returns the current date.
CurrentDate() schema.QueryAppender
// CurrentTime returns the current time.
CurrentTime() schema.QueryAppender
// CurrentTimestamp returns the current timestamp.
CurrentTimestamp() schema.QueryAppender
// Now returns the current timestamp (alias for CurrentTimestamp).
Now() schema.QueryAppender
// ExtractYear extracts the year from a date/timestamp.
ExtractYear(expr any) schema.QueryAppender
// ExtractMonth extracts the month from a date/timestamp.
ExtractMonth(expr any) schema.QueryAppender
// ExtractDay extracts the day from a date/timestamp.
ExtractDay(expr any) schema.QueryAppender
// ExtractHour extracts the hour from a timestamp.
ExtractHour(expr any) schema.QueryAppender
// ExtractMinute extracts the minute from a timestamp.
ExtractMinute(expr any) schema.QueryAppender
// ExtractSecond extracts the second from a timestamp.
ExtractSecond(expr any) schema.QueryAppender
// DateTrunc truncates date/timestamp to specified precision.
DateTrunc(unit DateTimeUnit, expr any) schema.QueryAppender
// DateAdd adds interval to date/timestamp.
DateAdd(expr, interval any, unit DateTimeUnit) schema.QueryAppender
// DateSubtract subtracts interval from date/timestamp.
DateSubtract(expr, interval any, unit DateTimeUnit) schema.QueryAppender
// DateDiff returns the difference between two dates in specified unit.
DateDiff(start, end any, unit DateTimeUnit) schema.QueryAppender
// Age returns the age (interval) between two timestamps.
Age(start, end any) schema.QueryAppender
// Abs returns the absolute value.
Abs(expr any) schema.QueryAppender
// Ceil returns the smallest integer greater than or equal to the value.
Ceil(expr any) schema.QueryAppender
// Floor returns the largest integer less than or equal to the value.
Floor(expr any) schema.QueryAppender
// Round rounds to the nearest integer or specified decimal places.
Round(expr any, precision ...any) schema.QueryAppender
// Trunc truncates to integer or specified decimal places.
Trunc(expr any, precision ...any) schema.QueryAppender
// Power returns base raised to the power of exponent.
Power(base, exponent any) schema.QueryAppender
// Sqrt returns the square root.
Sqrt(expr any) schema.QueryAppender
// Exp returns e raised to the power of the argument.
Exp(expr any) schema.QueryAppender
// Ln returns the natural logarithm.
Ln(expr any) schema.QueryAppender
// Log returns the logarithm with specified base (default base 10).
Log(expr any, base ...any) schema.QueryAppender
// Sin returns the sine.
Sin(expr any) schema.QueryAppender
// Cos returns the cosine.
Cos(expr any) schema.QueryAppender
// Tan returns the tangent.
Tan(expr any) schema.QueryAppender
// Asin returns the arcsine.
Asin(expr any) schema.QueryAppender
// Acos returns the arccosine.
Acos(expr any) schema.QueryAppender
// Atan returns the arctangent.
Atan(expr any) schema.QueryAppender
// Pi returns the value of π.
Pi() schema.QueryAppender
// Random returns a random value between 0 and 1.
Random() schema.QueryAppender
// Sign returns the sign of a number (-1, 0, or 1).
Sign(expr any) schema.QueryAppender
// Mod returns the remainder of division.
Mod(dividend, divisor any) schema.QueryAppender
// Greatest returns the greatest value among arguments.
Greatest(args ...any) schema.QueryAppender
// Least returns the least value among arguments.
Least(args ...any) schema.QueryAppender
// Coalesce returns the first non-null value.
Coalesce(args ...any) schema.QueryAppender
// NullIf returns null if the two arguments are equal, otherwise returns the first argument.
NullIf(expr1, expr2 any) schema.QueryAppender
// IfNull returns the second argument if the first is null, otherwise returns the first.
IfNull(expr, defaultValue any) schema.QueryAppender
// ToString converts expression to string.
ToString(expr any) schema.QueryAppender
// ToInteger converts expression to integer.
ToInteger(expr any) schema.QueryAppender
// ToDecimal converts expression to decimal with optional precision and scale.
ToDecimal(expr any, precision ...any) schema.QueryAppender
// ToFloat converts expression to float.
ToFloat(expr any) schema.QueryAppender
// ToBool converts expression to boolean.
ToBool(expr any) schema.QueryAppender
// ToDate converts expression to date.
ToDate(expr any, format ...any) schema.QueryAppender
// ToTime converts expression to time.
ToTime(expr any, format ...any) schema.QueryAppender
// ToTimestamp converts expression to timestamp.
ToTimestamp(expr any, format ...any) schema.QueryAppender
// ToJSON converts expression to JSON.
ToJSON(expr any) schema.QueryAppender
// JSONExtract extracts value from JSON at specified path.
JSONExtract(json, path any) schema.QueryAppender
// JSONUnquote removes quotes from JSON string.
JSONUnquote(expr any) schema.QueryAppender
// JSONArray creates a JSON array from arguments.
JSONArray(args ...any) schema.QueryAppender
// JSONObject creates a JSON object from key-value pairs.
JSONObject(keyValues ...any) schema.QueryAppender
// JSONContains checks if JSON contains a value.
JSONContains(json, value any) schema.QueryAppender
// JSONContainsPath checks if JSON contains a path.
JSONContainsPath(json, path any) schema.QueryAppender
// JSONKeys returns the keys of a JSON object.
JSONKeys(json any, path ...any) schema.QueryAppender
// JSONLength returns the length of a JSON array or object.
JSONLength(json any, path ...any) schema.QueryAppender
// JSONType returns the type of JSON value.
JSONType(json any, path ...any) schema.QueryAppender
// JSONValid checks if a string is valid JSON.
JSONValid(expr any) schema.QueryAppender
// JSONSet sets value at path in JSON (insert or update).
JSONSet(json, path, value any) schema.QueryAppender
// JSONInsert inserts value at path only if path doesn't exist.
JSONInsert(json, path, value any) schema.QueryAppender
// JSONReplace replaces value at path only if path exists.
JSONReplace(json, path, value any) schema.QueryAppender
// JSONArrayAppend appends value to JSON array at specified path.
JSONArrayAppend(json, path, value any) schema.QueryAppender
// Decode implements DECODE function (Oracle-style case expression).
// Usage: Decode(expr, search1, result1, search2, result2, ..., defaultResult)
Decode(args ...any) schema.QueryAppender
}
ExprBuilder provides methods for building various SQL expressions and operations. It offers a fluent Api for constructing complex SQL expressions including aggregates, functions, and conditional logic.
type Expressions ¶
type Expressions struct {
// contains filtered or unexported fields
}
func (*Expressions) AppendQuery ¶
type Filterable ¶
type Filterable[T QueryExecutor] interface { // Where adds a where clause to the query. Where(func(ConditionBuilder)) T // WherePK adds a where clause to the query using the primary key. WherePK(columns ...string) T // WhereDeleted adds a where clause to the query using the deleted column. WhereDeleted() T // IncludeDeleted includes soft-deleted records in the query results. IncludeDeleted() T }
Filterable is an interface that defines the methods for adding WHERE clauses to queries. It provides methods for filtering results based on conditions and supports soft delete operations.
type FirstValueBuilder ¶
type FirstValueBuilder interface {
WindowPartitionable[WindowFrameablePartitionBuilder]
NullHandlingBuilder[FirstValueBuilder]
Column(column string) FirstValueBuilder
Expr(expr any) FirstValueBuilder
}
FirstValueBuilder defines the FIRST_VALUE() window function builder.
type FrameBoundKind ¶
type FrameBoundKind int
FrameBoundKind specifies the bound type in a window frame.
const ( FrameBoundNone FrameBoundKind = iota FrameBoundUnboundedPreceding FrameBoundUnboundedFollowing FrameBoundCurrentRow FrameBoundPreceding FrameBoundFollowing )
func (FrameBoundKind) String ¶
func (f FrameBoundKind) String() string
type FromDirection ¶
type FromDirection int
FromDirection specifies the direction for window frame FROM clause.
const ( FromDefault FromDirection = iota FromFirst FromLast )
func (FromDirection) String ¶
func (f FromDirection) String() string
type FuzzyKind ¶
type FuzzyKind uint8
FuzzyKind represents the wildcard placement for LIKE patterns.
func (FuzzyKind) BuildPattern ¶ added in v0.14.0
BuildPattern constructs a LIKE pattern string based on the FuzzyKind. It efficiently builds the pattern using strings.Builder with pre-allocated capacity.
type IDHandler ¶ added in v0.18.0
type IDHandler struct{}
IDHandler implements InsertHandler for automatically generating unique primary key IDs. It uses Snowflake algorithm to generate distributed unique IDs in Base36 format.
func (*IDHandler) OnInsert ¶ added in v0.18.0
func (*IDHandler) OnInsert(_ *BunInsertQuery, _ *schema.Table, field *schema.Field, _ any, value reflect.Value)
OnInsert automatically generates a unique ID for string primary key fields that are zero-valued. It only applies to primary key fields of string type that haven't been explicitly set.
type IDModel ¶ added in v0.18.0
type IDModel struct {
ID string `json:"id" bun:"id,pk"`
}
IDModel contains only the primary key field.
type InsertColumnHandler ¶ added in v0.7.1
type InsertColumnHandler interface {
ColumnHandler
// OnInsert is called when a new record is being inserted.
// It allows the handler to automatically set or modify column values.
OnInsert(query *BunInsertQuery, table *schema.Table, field *schema.Field, model any, value reflect.Value)
}
InsertColumnHandler is an interface for handlers that automatically manage columns during insert operations. Handlers implementing this interface will be called before insert operations to set column values.
type InsertQuery ¶
type InsertQuery interface {
QueryBuilder
QueryExecutor
DBAccessor
CTE[InsertQuery]
TableSource[InsertQuery]
Selectable[InsertQuery]
ColumnUpdatable[InsertQuery]
Returnable[InsertQuery]
Applier[InsertQuery]
// OnConflict configures conflict handling (UPSERT) using a builder.
OnConflict(func(ConflictBuilder)) InsertQuery
}
InsertQuery is an interface that defines the methods for building and executing INSERT queries. It supports conflict resolution, column selection, and expression-based values.
type InsertQueryConflictBuilder ¶
type InsertQueryConflictBuilder struct {
// contains filtered or unexported fields
}
func (*InsertQueryConflictBuilder) Columns ¶
func (b *InsertQueryConflictBuilder) Columns(columns ...string) ConflictBuilder
func (*InsertQueryConflictBuilder) Constraint ¶
func (b *InsertQueryConflictBuilder) Constraint(name string) ConflictBuilder
func (*InsertQueryConflictBuilder) DoNothing ¶
func (b *InsertQueryConflictBuilder) DoNothing()
func (*InsertQueryConflictBuilder) DoUpdate ¶
func (b *InsertQueryConflictBuilder) DoUpdate() ConflictUpdateBuilder
func (*InsertQueryConflictBuilder) Where ¶
func (b *InsertQueryConflictBuilder) Where(builder func(ConditionBuilder)) ConflictBuilder
type InsertQueryConflictUpdateBuilder ¶
type InsertQueryConflictUpdateBuilder struct {
// contains filtered or unexported fields
}
InsertQueryConflictUpdateBuilder implements ConflictUpdateBuilder interface.
func (*InsertQueryConflictUpdateBuilder) Set ¶
func (b *InsertQueryConflictUpdateBuilder) Set(column string, value ...any) ConflictUpdateBuilder
func (*InsertQueryConflictUpdateBuilder) SetExpr ¶
func (b *InsertQueryConflictUpdateBuilder) SetExpr(column string, builder func(ExprBuilder) any) ConflictUpdateBuilder
func (*InsertQueryConflictUpdateBuilder) Where ¶
func (b *InsertQueryConflictUpdateBuilder) Where(builder func(ConditionBuilder)) ConflictUpdateBuilder
type JSONArrayAggBuilder ¶
type JSONArrayAggBuilder interface {
BaseAggregate[JSONArrayAggBuilder]
DistinctableAggregate[JSONArrayAggBuilder]
OrderableAggregate[JSONArrayAggBuilder]
}
JSONArrayAggBuilder defines the JSON_ARRAY_AGG aggregate function builder.
type JSONObjectAggBuilder ¶
type JSONObjectAggBuilder interface {
BaseAggregate[JSONObjectAggBuilder]
DistinctableAggregate[JSONObjectAggBuilder]
OrderableAggregate[JSONObjectAggBuilder]
KeyColumn(column string) JSONObjectAggBuilder
KeyExpr(expr any) JSONObjectAggBuilder
}
JSONObjectAggBuilder defines the JSON_OBJECT_AGG aggregate function builder.
type JoinOperations ¶
type JoinOperations[T any] interface { // Join performs an INNER JOIN with a model. Join(model any, builder func(ConditionBuilder), alias ...string) T // JoinTable performs an INNER JOIN with a table name. JoinTable(name string, builder func(ConditionBuilder), alias ...string) T // JoinSubQuery performs an INNER JOIN with a subquery. JoinSubQuery(sqBuilder func(query SelectQuery), cBuilder func(ConditionBuilder), alias ...string) T // JoinExpr performs an INNER JOIN with a custom expression. JoinExpr(eBuilder func(ExprBuilder) any, cBuilder func(ConditionBuilder), alias ...string) T // LeftJoin performs a LEFT OUTER JOIN with a model. LeftJoin(model any, builder func(ConditionBuilder), alias ...string) T // LeftJoinTable performs a LEFT OUTER JOIN with a table name. LeftJoinTable(name string, builder func(ConditionBuilder), alias ...string) T // LeftJoinSubQuery performs a LEFT OUTER JOIN with a subquery. LeftJoinSubQuery(sqBuilder func(query SelectQuery), cBuilder func(ConditionBuilder), alias ...string) T // LeftJoinExpr performs a LEFT OUTER JOIN with a custom expression. LeftJoinExpr(eBuilder func(ExprBuilder) any, cBuilder func(ConditionBuilder), alias ...string) T // RightJoin performs a RIGHT OUTER JOIN with a model. RightJoin(model any, builder func(ConditionBuilder), alias ...string) T // RightJoinTable performs a RIGHT OUTER JOIN with a table name. RightJoinTable(name string, builder func(ConditionBuilder), alias ...string) T // RightJoinSubQuery performs a RIGHT OUTER JOIN with a subquery. RightJoinSubQuery(sqBuilder func(query SelectQuery), cBuilder func(ConditionBuilder), alias ...string) T // RightJoinExpr performs a RIGHT OUTER JOIN with a custom expression. RightJoinExpr(eBuilder func(ExprBuilder) any, cBuilder func(ConditionBuilder), alias ...string) T // FullJoin performs a FULL OUTER JOIN with a model. FullJoin(model any, builder func(ConditionBuilder), alias ...string) T // FullJoinTable performs a FULL OUTER JOIN with a table name. FullJoinTable(name string, builder func(ConditionBuilder), alias ...string) T // FullJoinSubQuery performs a FULL OUTER JOIN with a subquery. FullJoinSubQuery(sqBuilder func(query SelectQuery), cBuilder func(ConditionBuilder), alias ...string) T // FullJoinExpr performs a FULL OUTER JOIN with a custom expression. FullJoinExpr(eBuilder func(ExprBuilder) any, cBuilder func(ConditionBuilder), alias ...string) T // CrossJoin performs a CROSS JOIN with a model. CrossJoin(model any, alias ...string) T // CrossJoinTable performs a CROSS JOIN with a table name. CrossJoinTable(name string, alias ...string) T // CrossJoinSubQuery performs a CROSS JOIN with a subquery. CrossJoinSubQuery(sqBuilder func(query SelectQuery), alias ...string) T // CrossJoinExpr performs a CROSS JOIN with a custom expression. CrossJoinExpr(eBuilder func(ExprBuilder) any, alias ...string) T }
JoinOperations is an interface that defines the methods for joining tables in queries. It supports all standard SQL join types including INNER, LEFT, RIGHT, FULL, and CROSS joins with different source types.
type LagBuilder ¶
type LagBuilder interface {
WindowPartitionable[WindowPartitionBuilder]
Column(column string) LagBuilder
Expr(expr any) LagBuilder
Offset(offset int) LagBuilder // Number of rows to lag (default 1)
DefaultValue(value any) LagBuilder // Default value when no previous row exists
}
LagBuilder defines the LAG() window function builder.
type LastValueBuilder ¶
type LastValueBuilder interface {
WindowPartitionable[WindowFrameablePartitionBuilder]
NullHandlingBuilder[LastValueBuilder]
Column(column string) LastValueBuilder
Expr(expr any) LastValueBuilder
}
LastValueBuilder defines the LAST_VALUE() window function builder.
type LeadBuilder ¶
type LeadBuilder interface {
WindowPartitionable[WindowPartitionBuilder]
Column(column string) LeadBuilder
Expr(expr any) LeadBuilder
Offset(offset int) LeadBuilder // Number of rows to lead (default 1)
DefaultValue(value any) LeadBuilder // Default value when no next row exists
}
LeadBuilder defines the LEAD() window function builder.
type Limitable ¶
type Limitable[T QueryExecutor] interface { // Limit limits the number of rows returned by the query. Limit(limit int) T }
Limitable is an interface that defines the methods for limiting the number of rows returned by a query. It provides the LIMIT clause functionality for result set size control.
type MaxBuilder ¶
type MaxBuilder interface {
BaseAggregate[MaxBuilder]
}
MaxBuilder defines the MAX aggregate function builder.
type MergeInsertBuilder ¶
type MergeInsertBuilder interface {
// Value sets a single column to a specific value for insertion.
Value(column string, value any) MergeInsertBuilder
// ValueExpr sets a single column using an expression builder for insertion.
ValueExpr(column string, builder func(ExprBuilder) any) MergeInsertBuilder
// Values sets multiple columns from the SOURCE table (e.g., INSERT (col1, col2) VALUES (SOURCE.col1, SOURCE.col2)).
// Each column will be inserted with its corresponding value from the source.
Values(columns ...string) MergeInsertBuilder
// ValuesAll sets all columns from the table schema to their corresponding SOURCE values for insertion.
// Columns specified in excludedColumns will be skipped (useful for excluding auto-generated columns).
ValuesAll(excludedColumns ...string) MergeInsertBuilder
}
MergeInsertBuilder is an interface for configuring INSERT actions in MERGE queries. It allows specifying which columns and values to insert. This builder is used within ThenInsert() to configure the insert operation.
type MergeQuery ¶
type MergeQuery interface {
QueryBuilder
QueryExecutor
DBAccessor
CTE[MergeQuery]
TableSource[MergeQuery]
Returnable[MergeQuery]
Applier[MergeQuery]
// Using specifies a model as the source for the merge operation.
Using(model any, alias ...string) MergeQuery
// UsingTable specifies the source table for the merge operation.
UsingTable(table string, alias ...string) MergeQuery
// UsingExpr specifies a expression as the source for the merge operation.
UsingExpr(builder func(ExprBuilder) any, alias ...string) MergeQuery
// UsingSubQuery specifies a subquery as the source for the merge operation.
UsingSubQuery(builder func(SelectQuery), alias ...string) MergeQuery
// On specifies the merge condition that determines matches between target and source.
On(func(ConditionBuilder)) MergeQuery
// WhenMatched starts a conditional action block for when records match.
WhenMatched(builder ...func(ConditionBuilder)) MergeWhenBuilder
// WhenNotMatched starts a conditional action block for when records don't match in target.
WhenNotMatched(builder ...func(ConditionBuilder)) MergeWhenBuilder
// WhenNotMatchedByTarget starts a conditional action block for when records don't match in target (explicit form).
WhenNotMatchedByTarget(builder ...func(ConditionBuilder)) MergeWhenBuilder
// WhenNotMatchedBySource starts a conditional action block for when records don't match in source.
WhenNotMatchedBySource(builder ...func(ConditionBuilder)) MergeWhenBuilder
}
MergeQuery is an interface that defines the methods for building and executing MERGE queries. It supports complex merge operations with conditional actions based on match/no-match scenarios.
type MergeUpdateBuilder ¶
type MergeUpdateBuilder interface {
// Set sets a single column to a specific value.
Set(column string, value any) MergeUpdateBuilder
// SetExpr sets a single column using an expression builder.
SetExpr(column string, builder func(ExprBuilder) any) MergeUpdateBuilder
// SetColumns sets multiple columns from the SOURCE table (e.g., column = SOURCE.column).
// Each column will be updated with its corresponding value from the source.
SetColumns(columns ...string) MergeUpdateBuilder
// SetAll sets all columns from the table schema to their corresponding SOURCE values.
// Columns specified in excludedColumns will be skipped (useful for excluding id, created_at, etc.).
SetAll(excludedColumns ...string) MergeUpdateBuilder
}
MergeUpdateBuilder is an interface for configuring UPDATE actions in MERGE queries. It allows setting column values and expressions for update operations. This builder is used within ThenUpdate() to specify which columns should be updated.
type MergeWhenBuilder ¶
type MergeWhenBuilder interface {
// ThenUpdate specifies an UPDATE action for the WHEN clause.
// Use the provided MergeUpdateBuilder to configure which columns to update.
ThenUpdate(func(MergeUpdateBuilder)) MergeQuery
// ThenInsert specifies an INSERT action for the WHEN clause.
// Use the provided MergeInsertBuilder to configure which columns and values to insert.
ThenInsert(func(MergeInsertBuilder)) MergeQuery
// ThenDelete specifies a DELETE action for the WHEN clause.
ThenDelete() MergeQuery
// ThenDoNothing specifies no action for the WHEN clause.
ThenDoNothing() MergeQuery
}
MergeWhenBuilder is an interface for defining actions in MERGE WHEN clauses. It provides methods to specify what action to take when merge conditions are met. This interface is returned by WhenMatched, WhenNotMatched, and related methods on MergeQuery.
type MinBuilder ¶
type MinBuilder interface {
BaseAggregate[MinBuilder]
}
MinBuilder defines the MIN aggregate function builder.
type Model ¶
type Model struct {
// ID is the primary key of the model
ID string `json:"id" bun:"id,pk"`
// CreatedAt is the created at time of the model
CreatedAt datetime.DateTime `json:"createdAt" bun:",notnull,type:timestamp,default:CURRENT_TIMESTAMP,skipupdate"`
// CreatedBy is the created by of the model
CreatedBy string `json:"createdBy" bun:",notnull,skipupdate" mold:"translate=user?"`
// CreatedByName is the created by name of the model
CreatedByName string `json:"createdByName" bun:",scanonly"`
// UpdatedAt is the updated at time of the model
UpdatedAt datetime.DateTime `json:"updatedAt" bun:",notnull,type:timestamp,default:CURRENT_TIMESTAMP"`
// UpdatedBy is the updated by of the model
UpdatedBy string `json:"updatedBy" bun:",notnull" mold:"translate=user?"`
// UpdatedByName is the updated by name of the model
UpdatedByName string `json:"updatedByName" bun:",scanonly"`
}
Model is the base model for all models.
type NTileBuilder ¶ added in v0.14.0
type NTileBuilder interface {
WindowPartitionable[WindowFrameablePartitionBuilder]
Buckets(n int) NTileBuilder
}
NTileBuilder defines the NTILE(n) window function builder.
type NthValueBuilder ¶
type NthValueBuilder interface {
WindowPartitionable[WindowFrameablePartitionBuilder]
NullHandlingBuilder[NthValueBuilder]
Column(column string) NthValueBuilder
Expr(expr any) NthValueBuilder
N(n int) NthValueBuilder
FromFirst() NthValueBuilder
FromLast() NthValueBuilder
}
NthValueBuilder defines the NTH_VALUE() window function builder.
type NullHandlingBuilder ¶
type NullHandlingBuilder[T any] interface { // IgnoreNulls configures the aggregate to ignore NULL values. IgnoreNulls() T // RespectNulls configures the aggregate to respect NULL values. RespectNulls() T }
NullHandlingBuilder defines aggregate functions that support NULL value handling.
type OrderBuilder ¶
type OrderBuilder interface {
// Column specifies the column name to order by
Column(column string) OrderBuilder
// Expr allows ordering by a SQL expression
Expr(expr any) OrderBuilder
Asc() OrderBuilder
Desc() OrderBuilder
NullsFirst() OrderBuilder
NullsLast() OrderBuilder
}
OrderBuilder provides a fluent interface for building ORDER BY clauses.
type Orderable ¶
type Orderable[T QueryExecutor] interface { // OrderBy orders the query by a column. OrderBy(columns ...string) T // OrderByDesc orders the query by a column in descending order. OrderByDesc(columns ...string) T // OrderByExpr orders the query by an expression. OrderByExpr(func(ExprBuilder) any) T }
Orderable is an interface that defines the methods for ordering query results. It supports ordering by columns and expressions in ascending or descending order.
type OrderableAggregate ¶
type OrderableAggregate[T any] interface { // OrderBy adds ORDER BY clauses with ascending direction inside the aggregate. OrderBy(columns ...string) T // OrderByDesc adds ORDER BY clauses with descending direction inside the aggregate. OrderByDesc(columns ...string) T // OrderByExpr adds an ORDER BY clause based on a raw expression inside the aggregate. OrderByExpr(expr any) T }
OrderableAggregate defines aggregate functions that support ordering.
type PKConditionBuilder ¶
type PKConditionBuilder interface {
// PKEquals is a condition that checks if the primary key is equal to a value.
PKEquals(pk any, alias ...string) ConditionBuilder
// OrPKEquals is a condition that checks if the primary key is equal to a value.
OrPKEquals(pk any, alias ...string) ConditionBuilder
// PKNotEquals is a condition that checks if the primary key is not equal to a value.
PKNotEquals(pk any, alias ...string) ConditionBuilder
// OrPKNotEquals is a condition that checks if the primary key is not equal to a value.
OrPKNotEquals(pk any, alias ...string) ConditionBuilder
// PKIn is a condition that checks if the primary key is in a list of values.
PKIn(pks any, alias ...string) ConditionBuilder
// OrPKIn is a condition that checks if the primary key is in a list of values.
OrPKIn(pks any, alias ...string) ConditionBuilder
// PKNotIn is a condition that checks if the primary key is not in a list of values.
PKNotIn(pks any, alias ...string) ConditionBuilder
// OrPKNotIn is a condition that checks if the primary key is not in a list of values.
OrPKNotIn(pks any, alias ...string) ConditionBuilder
}
PKConditionBuilder is a builder for primary key conditions.
type PKField ¶
type PKField struct {
// Field is the Go struct field name, e.g. "UserID".
Field string
// Column is the database column name as defined in schema, e.g. "user_id".
Column string
// Name is the lower camel-case alias, usually used in params or Api payloads, e.g. "userID".
Name string
// contains filtered or unexported fields
}
PKField describes a model's primary key field with common aliases. It provides helpers to get/set the PK value on a concrete model instance.
func NewPKField ¶
NewPKField constructs a PKField helper from a bun schema.Field. Field is the Go struct field name; Column is the DB column name; Name is a lower-camel alias commonly used in params or API payloads.
type PercentRankBuilder ¶
type PercentRankBuilder interface {
WindowPartitionable[WindowFrameablePartitionBuilder]
}
PercentRankBuilder defines the PERCENT_RANK() window function builder.
type QueryBuilder ¶
type QueryBuilder interface {
fmt.Stringer
// Dialect returns the database dialect for cross-database compatibility.
Dialect() schema.Dialect
// GetTable returns the table information for the current query.
GetTable() *schema.Table
// Query returns the underlying bun query instance.
Query() bun.Query
// ExprBuilder returns the expression builder for this query.
ExprBuilder() ExprBuilder
// CreateSubQuery creates a new subquery from the given bun.SelectQuery.
// It returns a SelectQuery that can be used to build complex nested queries.
CreateSubQuery(subQuery *bun.SelectQuery) SelectQuery
// BuildSubQuery constructs a subquery using a builder function.
// The builder function receives a SelectQuery to configure the subquery.
// Returns the configured bun.SelectQuery for use in parent queries.
BuildSubQuery(builder func(query SelectQuery)) *bun.SelectQuery
// BuildCondition creates a condition builder for WHERE clauses.
// The builder function receives a ConditionBuilder to configure conditions.
// Returns the configured ConditionBuilder for use in query filtering.
BuildCondition(builder func(ConditionBuilder)) interface {
schema.QueryAppender
ConditionBuilder
}
}
QueryBuilder defines the common interface for building subqueries and conditions. It provides a unified way to create subqueries and condition builders across different query types.
type QueryConditionBuilder ¶
type QueryConditionBuilder struct {
*CriteriaBuilder
}
QueryConditionBuilder is a builder for building query conditions.
type QueryExecutor ¶
type QueryExecutor interface {
// Exec executes a query and returns the result.
Exec(ctx context.Context, dest ...any) (sql.Result, error)
// Scan scans the result into a slice of any type.
Scan(ctx context.Context, dest ...any) error
}
QueryExecutor is an interface that defines the methods for executing database queries. It provides the basic execution methods that all query types must implement.
type QueryExprBuilder ¶
type QueryExprBuilder struct {
// contains filtered or unexported fields
}
QueryExprBuilder implements the ExprBuilder interface, providing methods to build various SQL expressions.
func (*QueryExprBuilder) Abs ¶
func (b *QueryExprBuilder) Abs(expr any) schema.QueryAppender
func (*QueryExprBuilder) Acos ¶
func (b *QueryExprBuilder) Acos(expr any) schema.QueryAppender
func (*QueryExprBuilder) Add ¶ added in v0.7.1
func (b *QueryExprBuilder) Add(left, right any) schema.QueryAppender
func (*QueryExprBuilder) Age ¶
func (b *QueryExprBuilder) Age(start, end any) schema.QueryAppender
Age returns the age (interval) between two timestamps. Returns a PostgreSQL-compatible interval string in format: "X years Y mons Z days" This provides a symbolic result using field-by-field subtraction with adjustments.
func (*QueryExprBuilder) All ¶ added in v0.7.1
func (b *QueryExprBuilder) All(builder func(SelectQuery)) schema.QueryAppender
func (*QueryExprBuilder) AllColumns ¶ added in v0.15.0
func (b *QueryExprBuilder) AllColumns(tableAlias ...string) schema.QueryAppender
func (*QueryExprBuilder) Any ¶ added in v0.7.1
func (b *QueryExprBuilder) Any(builder func(SelectQuery)) schema.QueryAppender
func (*QueryExprBuilder) ArrayAgg ¶
func (b *QueryExprBuilder) ArrayAgg(builder func(ArrayAggBuilder)) schema.QueryAppender
func (*QueryExprBuilder) Asin ¶
func (b *QueryExprBuilder) Asin(expr any) schema.QueryAppender
func (*QueryExprBuilder) Atan ¶
func (b *QueryExprBuilder) Atan(expr any) schema.QueryAppender
func (*QueryExprBuilder) Avg ¶
func (b *QueryExprBuilder) Avg(builder func(AvgBuilder)) schema.QueryAppender
func (*QueryExprBuilder) AvgColumn ¶
func (b *QueryExprBuilder) AvgColumn(column string, distinct ...bool) schema.QueryAppender
func (*QueryExprBuilder) Between ¶ added in v0.14.0
func (b *QueryExprBuilder) Between(expr, lower, upper any) schema.QueryAppender
func (*QueryExprBuilder) BitAnd ¶
func (b *QueryExprBuilder) BitAnd(builder func(BitAndBuilder)) schema.QueryAppender
func (*QueryExprBuilder) BitOr ¶
func (b *QueryExprBuilder) BitOr(builder func(BitOrBuilder)) schema.QueryAppender
func (*QueryExprBuilder) BoolAnd ¶
func (b *QueryExprBuilder) BoolAnd(builder func(BoolAndBuilder)) schema.QueryAppender
func (*QueryExprBuilder) BoolOr ¶
func (b *QueryExprBuilder) BoolOr(builder func(BoolOrBuilder)) schema.QueryAppender
func (*QueryExprBuilder) Case ¶
func (b *QueryExprBuilder) Case(builder func(CaseBuilder)) schema.QueryAppender
func (*QueryExprBuilder) Ceil ¶
func (b *QueryExprBuilder) Ceil(expr any) schema.QueryAppender
func (*QueryExprBuilder) CharLength ¶
func (b *QueryExprBuilder) CharLength(expr any) schema.QueryAppender
func (*QueryExprBuilder) Coalesce ¶
func (b *QueryExprBuilder) Coalesce(args ...any) schema.QueryAppender
func (*QueryExprBuilder) Column ¶
func (b *QueryExprBuilder) Column(column string, withTableAlias ...bool) schema.QueryAppender
func (*QueryExprBuilder) Concat ¶
func (b *QueryExprBuilder) Concat(args ...any) schema.QueryAppender
func (*QueryExprBuilder) ConcatWithSep ¶ added in v0.7.1
func (b *QueryExprBuilder) ConcatWithSep(separator any, args ...any) schema.QueryAppender
func (*QueryExprBuilder) Contains ¶ added in v0.14.0
func (b *QueryExprBuilder) Contains(expr, substr any) schema.QueryAppender
func (*QueryExprBuilder) ContainsIgnoreCase ¶ added in v0.14.0
func (b *QueryExprBuilder) ContainsIgnoreCase(expr, substr any) schema.QueryAppender
func (*QueryExprBuilder) Cos ¶
func (b *QueryExprBuilder) Cos(expr any) schema.QueryAppender
func (*QueryExprBuilder) Count ¶
func (b *QueryExprBuilder) Count(builder func(CountBuilder)) schema.QueryAppender
func (*QueryExprBuilder) CountAll ¶
func (b *QueryExprBuilder) CountAll(distinct ...bool) schema.QueryAppender
func (*QueryExprBuilder) CountColumn ¶
func (b *QueryExprBuilder) CountColumn(column string, distinct ...bool) schema.QueryAppender
func (*QueryExprBuilder) CumeDist ¶
func (b *QueryExprBuilder) CumeDist(builder func(CumeDistBuilder)) schema.QueryAppender
func (*QueryExprBuilder) CurrentDate ¶
func (b *QueryExprBuilder) CurrentDate() schema.QueryAppender
func (*QueryExprBuilder) CurrentTime ¶
func (b *QueryExprBuilder) CurrentTime() schema.QueryAppender
func (*QueryExprBuilder) CurrentTimestamp ¶
func (b *QueryExprBuilder) CurrentTimestamp() schema.QueryAppender
func (*QueryExprBuilder) DateAdd ¶
func (b *QueryExprBuilder) DateAdd(expr, interval any, unit DateTimeUnit) schema.QueryAppender
func (*QueryExprBuilder) DateDiff ¶
func (b *QueryExprBuilder) DateDiff(start, end any, unit DateTimeUnit) schema.QueryAppender
func (*QueryExprBuilder) DateSubtract ¶
func (b *QueryExprBuilder) DateSubtract(expr, interval any, unit DateTimeUnit) schema.QueryAppender
func (*QueryExprBuilder) DateTrunc ¶
func (b *QueryExprBuilder) DateTrunc(unit DateTimeUnit, expr any) schema.QueryAppender
func (*QueryExprBuilder) Decode ¶
func (b *QueryExprBuilder) Decode(args ...any) schema.QueryAppender
func (*QueryExprBuilder) DenseRank ¶
func (b *QueryExprBuilder) DenseRank(builder func(DenseRankBuilder)) schema.QueryAppender
func (*QueryExprBuilder) Divide ¶ added in v0.7.1
func (b *QueryExprBuilder) Divide(left, right any) schema.QueryAppender
Divide creates a division expression (left / right). Note: To ensure consistent float results across all databases, we cast to REAL/DOUBLE/NUMERIC. This prevents integer division behavior in SQLite and PostgreSQL.
func (*QueryExprBuilder) EndsWith ¶ added in v0.14.0
func (b *QueryExprBuilder) EndsWith(expr, suffix any) schema.QueryAppender
func (*QueryExprBuilder) EndsWithIgnoreCase ¶ added in v0.14.0
func (b *QueryExprBuilder) EndsWithIgnoreCase(expr, suffix any) schema.QueryAppender
func (*QueryExprBuilder) Equals ¶ added in v0.7.1
func (b *QueryExprBuilder) Equals(left, right any) schema.QueryAppender
func (*QueryExprBuilder) ExecByDialect ¶ added in v0.7.1
func (b *QueryExprBuilder) ExecByDialect(execs DialectExecs)
ExecByDialect executes database-specific side-effect callbacks based on the current dialect.
func (*QueryExprBuilder) ExecByDialectWithErr ¶ added in v0.7.1
func (b *QueryExprBuilder) ExecByDialectWithErr(execs DialectExecsWithErr) error
ExecByDialectWithErr executes database-specific callbacks that can return an error.
func (*QueryExprBuilder) Exists ¶ added in v0.7.1
func (b *QueryExprBuilder) Exists(builder func(SelectQuery)) schema.QueryAppender
func (*QueryExprBuilder) Exp ¶
func (b *QueryExprBuilder) Exp(expr any) schema.QueryAppender
func (*QueryExprBuilder) Expr ¶
func (*QueryExprBuilder) Expr(expr string, args ...any) schema.QueryAppender
func (*QueryExprBuilder) ExprByDialect ¶
func (b *QueryExprBuilder) ExprByDialect(exprs DialectExprs) schema.QueryAppender
ExprByDialect creates a cross-database compatible expression. It selects the appropriate expression builder based on the current database dialect.
func (*QueryExprBuilder) Exprs ¶
func (*QueryExprBuilder) Exprs(exprs ...any) schema.QueryAppender
func (*QueryExprBuilder) ExprsWithSep ¶ added in v0.7.1
func (*QueryExprBuilder) ExprsWithSep(sep any, exprs ...any) schema.QueryAppender
func (*QueryExprBuilder) ExtractDay ¶
func (b *QueryExprBuilder) ExtractDay(expr any) schema.QueryAppender
func (*QueryExprBuilder) ExtractHour ¶
func (b *QueryExprBuilder) ExtractHour(expr any) schema.QueryAppender
func (*QueryExprBuilder) ExtractMinute ¶
func (b *QueryExprBuilder) ExtractMinute(expr any) schema.QueryAppender
func (*QueryExprBuilder) ExtractMonth ¶
func (b *QueryExprBuilder) ExtractMonth(expr any) schema.QueryAppender
func (*QueryExprBuilder) ExtractSecond ¶
func (b *QueryExprBuilder) ExtractSecond(expr any) schema.QueryAppender
func (*QueryExprBuilder) ExtractYear ¶
func (b *QueryExprBuilder) ExtractYear(expr any) schema.QueryAppender
func (*QueryExprBuilder) FirstValue ¶
func (b *QueryExprBuilder) FirstValue(builder func(FirstValueBuilder)) schema.QueryAppender
func (*QueryExprBuilder) Floor ¶
func (b *QueryExprBuilder) Floor(expr any) schema.QueryAppender
func (*QueryExprBuilder) FragmentByDialect ¶ added in v0.7.1
func (b *QueryExprBuilder) FragmentByDialect(fragments DialectFragments) ([]byte, error)
FragmentByDialect executes database-specific callbacks that return query fragments.
func (*QueryExprBuilder) GreaterThan ¶ added in v0.7.1
func (b *QueryExprBuilder) GreaterThan(left, right any) schema.QueryAppender
func (*QueryExprBuilder) GreaterThanOrEqual ¶ added in v0.7.1
func (b *QueryExprBuilder) GreaterThanOrEqual(left, right any) schema.QueryAppender
func (*QueryExprBuilder) Greatest ¶
func (b *QueryExprBuilder) Greatest(args ...any) schema.QueryAppender
func (*QueryExprBuilder) IfNull ¶
func (b *QueryExprBuilder) IfNull(expr, defaultValue any) schema.QueryAppender
func (*QueryExprBuilder) In ¶ added in v0.14.0
func (b *QueryExprBuilder) In(expr any, values ...any) schema.QueryAppender
func (*QueryExprBuilder) IsFalse ¶ added in v0.14.0
func (b *QueryExprBuilder) IsFalse(expr any) schema.QueryAppender
func (*QueryExprBuilder) IsNotNull ¶
func (b *QueryExprBuilder) IsNotNull(expr any) schema.QueryAppender
func (*QueryExprBuilder) IsNull ¶
func (b *QueryExprBuilder) IsNull(expr any) schema.QueryAppender
func (*QueryExprBuilder) IsTrue ¶ added in v0.14.0
func (b *QueryExprBuilder) IsTrue(expr any) schema.QueryAppender
func (*QueryExprBuilder) JSONArray ¶
func (b *QueryExprBuilder) JSONArray(args ...any) schema.QueryAppender
func (*QueryExprBuilder) JSONArrayAgg ¶
func (b *QueryExprBuilder) JSONArrayAgg(builder func(JSONArrayAggBuilder)) schema.QueryAppender
func (*QueryExprBuilder) JSONArrayAppend ¶
func (b *QueryExprBuilder) JSONArrayAppend(json, path, value any) schema.QueryAppender
func (*QueryExprBuilder) JSONContains ¶
func (b *QueryExprBuilder) JSONContains(json, value any) schema.QueryAppender
func (*QueryExprBuilder) JSONContainsPath ¶
func (b *QueryExprBuilder) JSONContainsPath(json, path any) schema.QueryAppender
func (*QueryExprBuilder) JSONExtract ¶
func (b *QueryExprBuilder) JSONExtract(json, path any) schema.QueryAppender
JSONExtract extracts value from JSON at specified path.
Note: For PostgreSQL, this uses the #>> operator which returns the value as text (unquoted). This is compatible with b.ToJSON() which will correctly cast the text back to JSONB if the result is used in subsequent JSON functions (e.g. chaining JSONExtract).
func (*QueryExprBuilder) JSONInsert ¶
func (b *QueryExprBuilder) JSONInsert(json, path, value any) schema.QueryAppender
func (*QueryExprBuilder) JSONKeys ¶
func (b *QueryExprBuilder) JSONKeys(json any, path ...any) schema.QueryAppender
func (*QueryExprBuilder) JSONLength ¶
func (b *QueryExprBuilder) JSONLength(json any, path ...any) schema.QueryAppender
func (*QueryExprBuilder) JSONObject ¶
func (b *QueryExprBuilder) JSONObject(keyValues ...any) schema.QueryAppender
func (*QueryExprBuilder) JSONObjectAgg ¶
func (b *QueryExprBuilder) JSONObjectAgg(builder func(JSONObjectAggBuilder)) schema.QueryAppender
func (*QueryExprBuilder) JSONReplace ¶
func (b *QueryExprBuilder) JSONReplace(json, path, value any) schema.QueryAppender
func (*QueryExprBuilder) JSONSet ¶
func (b *QueryExprBuilder) JSONSet(json, path, value any) schema.QueryAppender
func (*QueryExprBuilder) JSONType ¶
func (b *QueryExprBuilder) JSONType(json any, path ...any) schema.QueryAppender
func (*QueryExprBuilder) JSONUnquote ¶
func (b *QueryExprBuilder) JSONUnquote(expr any) schema.QueryAppender
func (*QueryExprBuilder) JSONValid ¶
func (b *QueryExprBuilder) JSONValid(expr any) schema.QueryAppender
func (*QueryExprBuilder) Lag ¶
func (b *QueryExprBuilder) Lag(builder func(LagBuilder)) schema.QueryAppender
func (*QueryExprBuilder) LastValue ¶
func (b *QueryExprBuilder) LastValue(builder func(LastValueBuilder)) schema.QueryAppender
func (*QueryExprBuilder) Lead ¶
func (b *QueryExprBuilder) Lead(builder func(LeadBuilder)) schema.QueryAppender
func (*QueryExprBuilder) Least ¶
func (b *QueryExprBuilder) Least(args ...any) schema.QueryAppender
func (*QueryExprBuilder) Left ¶
func (b *QueryExprBuilder) Left(expr, length any) schema.QueryAppender
func (*QueryExprBuilder) Length ¶
func (b *QueryExprBuilder) Length(expr any) schema.QueryAppender
func (*QueryExprBuilder) LessThan ¶ added in v0.7.1
func (b *QueryExprBuilder) LessThan(left, right any) schema.QueryAppender
func (*QueryExprBuilder) LessThanOrEqual ¶ added in v0.7.1
func (b *QueryExprBuilder) LessThanOrEqual(left, right any) schema.QueryAppender
func (*QueryExprBuilder) Literal ¶
func (b *QueryExprBuilder) Literal(value any) schema.QueryAppender
func (*QueryExprBuilder) Ln ¶
func (b *QueryExprBuilder) Ln(expr any) schema.QueryAppender
func (*QueryExprBuilder) Log ¶
func (b *QueryExprBuilder) Log(expr any, base ...any) schema.QueryAppender
func (*QueryExprBuilder) Lower ¶
func (b *QueryExprBuilder) Lower(expr any) schema.QueryAppender
func (*QueryExprBuilder) Max ¶
func (b *QueryExprBuilder) Max(builder func(MaxBuilder)) schema.QueryAppender
func (*QueryExprBuilder) MaxColumn ¶
func (b *QueryExprBuilder) MaxColumn(column string) schema.QueryAppender
func (*QueryExprBuilder) Min ¶
func (b *QueryExprBuilder) Min(builder func(MinBuilder)) schema.QueryAppender
func (*QueryExprBuilder) MinColumn ¶
func (b *QueryExprBuilder) MinColumn(column string) schema.QueryAppender
func (*QueryExprBuilder) Mod ¶
func (b *QueryExprBuilder) Mod(dividend, divisor any) schema.QueryAppender
func (*QueryExprBuilder) Multiply ¶ added in v0.7.1
func (b *QueryExprBuilder) Multiply(left, right any) schema.QueryAppender
func (*QueryExprBuilder) NTile ¶ added in v0.14.0
func (b *QueryExprBuilder) NTile(builder func(NTileBuilder)) schema.QueryAppender
func (*QueryExprBuilder) Not ¶ added in v0.7.1
func (b *QueryExprBuilder) Not(expr any) schema.QueryAppender
func (*QueryExprBuilder) NotBetween ¶ added in v0.14.0
func (b *QueryExprBuilder) NotBetween(expr, lower, upper any) schema.QueryAppender
func (*QueryExprBuilder) NotEquals ¶ added in v0.7.1
func (b *QueryExprBuilder) NotEquals(left, right any) schema.QueryAppender
func (*QueryExprBuilder) NotExists ¶ added in v0.7.1
func (b *QueryExprBuilder) NotExists(builder func(SelectQuery)) schema.QueryAppender
func (*QueryExprBuilder) NotIn ¶ added in v0.14.0
func (b *QueryExprBuilder) NotIn(expr any, values ...any) schema.QueryAppender
func (*QueryExprBuilder) Now ¶
func (b *QueryExprBuilder) Now() schema.QueryAppender
func (*QueryExprBuilder) NthValue ¶
func (b *QueryExprBuilder) NthValue(builder func(NthValueBuilder)) schema.QueryAppender
func (*QueryExprBuilder) Null ¶
func (*QueryExprBuilder) Null() schema.QueryAppender
func (*QueryExprBuilder) NullIf ¶
func (b *QueryExprBuilder) NullIf(expr1, expr2 any) schema.QueryAppender
func (*QueryExprBuilder) Order ¶
func (b *QueryExprBuilder) Order(builder func(OrderBuilder)) schema.QueryAppender
func (*QueryExprBuilder) Paren ¶ added in v0.7.1
func (b *QueryExprBuilder) Paren(expr any) schema.QueryAppender
func (*QueryExprBuilder) PercentRank ¶
func (b *QueryExprBuilder) PercentRank(builder func(PercentRankBuilder)) schema.QueryAppender
func (*QueryExprBuilder) Pi ¶
func (b *QueryExprBuilder) Pi() schema.QueryAppender
func (*QueryExprBuilder) Position ¶
func (b *QueryExprBuilder) Position(substring, str any) schema.QueryAppender
func (*QueryExprBuilder) Power ¶
func (b *QueryExprBuilder) Power(base, exponent any) schema.QueryAppender
func (*QueryExprBuilder) Random ¶
func (b *QueryExprBuilder) Random() schema.QueryAppender
func (*QueryExprBuilder) Rank ¶
func (b *QueryExprBuilder) Rank(builder func(RankBuilder)) schema.QueryAppender
func (*QueryExprBuilder) Repeat ¶
func (b *QueryExprBuilder) Repeat(expr, count any) schema.QueryAppender
func (*QueryExprBuilder) Replace ¶
func (b *QueryExprBuilder) Replace(expr, search, replacement any) schema.QueryAppender
func (*QueryExprBuilder) Reverse ¶
func (b *QueryExprBuilder) Reverse(expr any) schema.QueryAppender
func (*QueryExprBuilder) Right ¶
func (b *QueryExprBuilder) Right(expr, length any) schema.QueryAppender
func (*QueryExprBuilder) Round ¶
func (b *QueryExprBuilder) Round(expr any, precision ...any) schema.QueryAppender
func (*QueryExprBuilder) RowNumber ¶
func (b *QueryExprBuilder) RowNumber(builder func(RowNumberBuilder)) schema.QueryAppender
func (*QueryExprBuilder) Sign ¶
func (b *QueryExprBuilder) Sign(expr any) schema.QueryAppender
func (*QueryExprBuilder) Sin ¶
func (b *QueryExprBuilder) Sin(expr any) schema.QueryAppender
func (*QueryExprBuilder) Sqrt ¶
func (b *QueryExprBuilder) Sqrt(expr any) schema.QueryAppender
func (*QueryExprBuilder) StartsWith ¶ added in v0.14.0
func (b *QueryExprBuilder) StartsWith(expr, prefix any) schema.QueryAppender
func (*QueryExprBuilder) StartsWithIgnoreCase ¶ added in v0.14.0
func (b *QueryExprBuilder) StartsWithIgnoreCase(expr, prefix any) schema.QueryAppender
func (*QueryExprBuilder) StdDev ¶
func (b *QueryExprBuilder) StdDev(builder func(StdDevBuilder)) schema.QueryAppender
func (*QueryExprBuilder) StringAgg ¶
func (b *QueryExprBuilder) StringAgg(builder func(StringAggBuilder)) schema.QueryAppender
func (*QueryExprBuilder) SubQuery ¶ added in v0.7.1
func (b *QueryExprBuilder) SubQuery(builder func(SelectQuery)) schema.QueryAppender
func (*QueryExprBuilder) SubString ¶
func (b *QueryExprBuilder) SubString(expr, start any, length ...any) schema.QueryAppender
func (*QueryExprBuilder) Subtract ¶ added in v0.7.1
func (b *QueryExprBuilder) Subtract(left, right any) schema.QueryAppender
func (*QueryExprBuilder) Sum ¶
func (b *QueryExprBuilder) Sum(builder func(SumBuilder)) schema.QueryAppender
func (*QueryExprBuilder) SumColumn ¶
func (b *QueryExprBuilder) SumColumn(column string, distinct ...bool) schema.QueryAppender
func (*QueryExprBuilder) TableColumns ¶ added in v0.15.0
func (b *QueryExprBuilder) TableColumns(withTableAlias ...bool) schema.QueryAppender
func (*QueryExprBuilder) Tan ¶
func (b *QueryExprBuilder) Tan(expr any) schema.QueryAppender
func (*QueryExprBuilder) ToBool ¶
func (b *QueryExprBuilder) ToBool(expr any) schema.QueryAppender
func (*QueryExprBuilder) ToDate ¶
func (b *QueryExprBuilder) ToDate(expr any, format ...any) schema.QueryAppender
func (*QueryExprBuilder) ToDecimal ¶
func (b *QueryExprBuilder) ToDecimal(expr any, precision ...any) schema.QueryAppender
func (*QueryExprBuilder) ToFloat ¶
func (b *QueryExprBuilder) ToFloat(expr any) schema.QueryAppender
func (*QueryExprBuilder) ToInteger ¶
func (b *QueryExprBuilder) ToInteger(expr any) schema.QueryAppender
func (*QueryExprBuilder) ToJSON ¶
func (b *QueryExprBuilder) ToJSON(expr any) schema.QueryAppender
func (*QueryExprBuilder) ToString ¶
func (b *QueryExprBuilder) ToString(expr any) schema.QueryAppender
func (*QueryExprBuilder) ToTime ¶
func (b *QueryExprBuilder) ToTime(expr any, format ...any) schema.QueryAppender
func (*QueryExprBuilder) ToTimestamp ¶
func (b *QueryExprBuilder) ToTimestamp(expr any, format ...any) schema.QueryAppender
func (*QueryExprBuilder) Trim ¶
func (b *QueryExprBuilder) Trim(expr any) schema.QueryAppender
func (*QueryExprBuilder) TrimLeft ¶
func (b *QueryExprBuilder) TrimLeft(expr any) schema.QueryAppender
func (*QueryExprBuilder) TrimRight ¶
func (b *QueryExprBuilder) TrimRight(expr any) schema.QueryAppender
func (*QueryExprBuilder) Trunc ¶
func (b *QueryExprBuilder) Trunc(expr any, precision ...any) schema.QueryAppender
func (*QueryExprBuilder) Upper ¶
func (b *QueryExprBuilder) Upper(expr any) schema.QueryAppender
func (*QueryExprBuilder) Variance ¶
func (b *QueryExprBuilder) Variance(builder func(VarianceBuilder)) schema.QueryAppender
func (*QueryExprBuilder) WinArrayAgg ¶ added in v0.7.1
func (b *QueryExprBuilder) WinArrayAgg(builder func(WindowArrayAggBuilder)) schema.QueryAppender
func (*QueryExprBuilder) WinAvg ¶ added in v0.7.1
func (b *QueryExprBuilder) WinAvg(builder func(WindowAvgBuilder)) schema.QueryAppender
func (*QueryExprBuilder) WinBitAnd ¶ added in v0.7.1
func (b *QueryExprBuilder) WinBitAnd(builder func(WindowBitAndBuilder)) schema.QueryAppender
func (*QueryExprBuilder) WinBitOr ¶ added in v0.7.1
func (b *QueryExprBuilder) WinBitOr(builder func(WindowBitOrBuilder)) schema.QueryAppender
func (*QueryExprBuilder) WinBoolAnd ¶ added in v0.7.1
func (b *QueryExprBuilder) WinBoolAnd(builder func(WindowBoolAndBuilder)) schema.QueryAppender
func (*QueryExprBuilder) WinBoolOr ¶ added in v0.7.1
func (b *QueryExprBuilder) WinBoolOr(builder func(WindowBoolOrBuilder)) schema.QueryAppender
func (*QueryExprBuilder) WinCount ¶ added in v0.7.1
func (b *QueryExprBuilder) WinCount(builder func(WindowCountBuilder)) schema.QueryAppender
func (*QueryExprBuilder) WinJSONArrayAgg ¶ added in v0.18.0
func (b *QueryExprBuilder) WinJSONArrayAgg(builder func(WindowJSONArrayAggBuilder)) schema.QueryAppender
func (*QueryExprBuilder) WinJSONObjectAgg ¶ added in v0.18.0
func (b *QueryExprBuilder) WinJSONObjectAgg(builder func(WindowJSONObjectAggBuilder)) schema.QueryAppender
func (*QueryExprBuilder) WinMax ¶ added in v0.7.1
func (b *QueryExprBuilder) WinMax(builder func(WindowMaxBuilder)) schema.QueryAppender
func (*QueryExprBuilder) WinMin ¶ added in v0.7.1
func (b *QueryExprBuilder) WinMin(builder func(WindowMinBuilder)) schema.QueryAppender
func (*QueryExprBuilder) WinStdDev ¶ added in v0.7.1
func (b *QueryExprBuilder) WinStdDev(builder func(WindowStdDevBuilder)) schema.QueryAppender
func (*QueryExprBuilder) WinStringAgg ¶ added in v0.7.1
func (b *QueryExprBuilder) WinStringAgg(builder func(WindowStringAggBuilder)) schema.QueryAppender
func (*QueryExprBuilder) WinSum ¶ added in v0.7.1
func (b *QueryExprBuilder) WinSum(builder func(WindowSumBuilder)) schema.QueryAppender
func (*QueryExprBuilder) WinVariance ¶ added in v0.7.1
func (b *QueryExprBuilder) WinVariance(builder func(WindowVarianceBuilder)) schema.QueryAppender
type RankBuilder ¶
type RankBuilder interface {
WindowPartitionable[WindowFrameablePartitionBuilder]
}
RankBuilder defines the RANK() window function builder.
type RawQuery ¶
type RawQuery interface {
QueryExecutor
}
RawQuery is an interface that defines the methods for executing raw SQL queries. It allows direct SQL execution with parameter binding for cases where the query builder is insufficient.
type RelationSpec ¶
type RelationSpec struct {
// Model is the related model to join (e.g., (*User)(nil))
Model any
// Alias is the table alias for the joined model.
// If empty, defaults to the model's default alias from table metadata.
Alias string
// JoinType specifies the type of JOIN operation (INNER, LEFT, RIGHT).
// If not specified (JoinDefault), defaults to LEFT JOIN.
JoinType JoinType
// ForeignColumn is the column in the main table that references the joined table.
// If empty, automatically resolves to "{model_name}_{primary_key}".
// Example: For a User model with pk "id", defaults to "user_id".
ForeignColumn string
// ReferencedColumn is the column in the joined table being referenced.
// If empty, defaults to the primary key of the joined model.
ReferencedColumn string
// SelectedColumns specifies which columns to select from the joined table.
// Use ColumnInfo to configure column aliases and auto-prefixing to avoid name conflicts.
SelectedColumns []ColumnInfo
// On is an optional function to add custom conditions to the JOIN clause.
// The basic equality condition (foreign_key = referenced_key) is applied automatically.
// Use this for additional filters like soft delete checks or status conditions.
// Example: func(cb ConditionBuilder) { cb.Equals("status", "active") }
On ApplyFunc[ConditionBuilder]
}
RelationSpec specifies how to join a related model using automatic column resolution. It provides a declarative way to define JOIN operations between models with minimal configuration. The spec automatically resolves foreign keys and primary keys based on model metadata and naming conventions.
type Returnable ¶
type Returnable[T QueryExecutor] interface { // Returning returns the query with the specified columns. Returning(columns ...string) T // ReturningAll returns the query with all columns. ReturningAll() T // ReturningNone returns the query with no columns. ReturningNone() T }
Returnable is an interface that defines the methods for specifying RETURNING clauses in queries. It allows queries to return data after INSERT, UPDATE, or DELETE operations.
type RowNumberBuilder ¶
type RowNumberBuilder interface {
WindowPartitionable[WindowFrameablePartitionBuilder]
}
RowNumberBuilder defines the ROW_NUMBER() window function builder.
type SelectQuery ¶
type SelectQuery interface {
QueryBuilder
SelectQueryExecutor
DBAccessor
CTE[SelectQuery]
Selectable[SelectQuery]
TableSource[SelectQuery]
JoinOperations[SelectQuery]
Filterable[SelectQuery]
Orderable[SelectQuery]
Limitable[SelectQuery]
Applier[SelectQuery]
// SelectAs selects a column with an alias.
SelectAs(column, alias string) SelectQuery
// SelectModelColumns selects the columns of a model.
// By default, all columns of the model are selected if no select-related methods are called.
SelectModelColumns() SelectQuery
// SelectModelPKs selects the primary keys of a model.
SelectModelPKs() SelectQuery
// SelectExpr selects a column with an expression.
SelectExpr(builder func(ExprBuilder) any, alias ...string) SelectQuery
// Distinct returns a distinct query.
Distinct() SelectQuery
// DistinctOnColumns returns a distinct query on columns.
DistinctOnColumns(columns ...string) SelectQuery
// DistinctOnExpr returns a distinct query on an expression.
DistinctOnExpr(builder func(ExprBuilder) any) SelectQuery
// JoinRelations applies RelationSpec configurations to perform JOIN operations with automatic column resolution.
// It provides a declarative way to join related models with minimal configuration.
JoinRelations(specs ...*RelationSpec) SelectQuery
// Relation joins a relation.
Relation(name string, apply ...func(query SelectQuery)) SelectQuery
// GroupBy groups the query by a column.
GroupBy(columns ...string) SelectQuery
// GroupByExpr groups the query by an expression.
GroupByExpr(func(ExprBuilder) any) SelectQuery
// Having adds a having clause to the query.
Having(func(ConditionBuilder)) SelectQuery
// Offset adds an offset to the query.
Offset(offset int) SelectQuery
// Paginate paginates the query.
Paginate(pageable page.Pageable) SelectQuery
ForShare(tables ...string) SelectQuery
ForShareNoWait(tables ...string) SelectQuery
ForShareSkipLocked(tables ...string) SelectQuery
// ForUpdate adds a for update lock to the query.
ForUpdate(tables ...string) SelectQuery
// ForUpdateNoWait adds a for update no wait lock to the query.
ForUpdateNoWait(tables ...string) SelectQuery
// ForUpdateSkipLocked adds a for update skip locked lock to the query.
ForUpdateSkipLocked(tables ...string) SelectQuery
// Union combines the result of this query with another query.
Union(func(query SelectQuery)) SelectQuery
// UnionAll combines the result of this query with another query, including duplicates.
UnionAll(func(query SelectQuery)) SelectQuery
// Intersect returns only rows that exist in both this query and another query.
Intersect(func(query SelectQuery)) SelectQuery
// IntersectAll returns only rows that exist in both queries, including duplicates.
IntersectAll(func(query SelectQuery)) SelectQuery
// Except returns rows that exist in this query but not in another query.
Except(func(query SelectQuery)) SelectQuery
// ExceptAll returns rows that exist in this query but not in another query, including duplicates.
ExceptAll(func(query SelectQuery)) SelectQuery
}
SelectQuery is an interface that defines the methods for building and executing SELECT queries. It provides a fluent Api for constructing complex database queries with support for joins, conditions, ordering, and more.
type SelectQueryExecutor ¶
type SelectQueryExecutor interface {
QueryExecutor
// Rows returns the result as a sql.Rows.
Rows(ctx context.Context) (*sql.Rows, error)
// ScanAndCount scans the result into a slice of any type and returns the count of the result.
ScanAndCount(ctx context.Context, dest ...any) (int64, error)
// Count returns the count of the result.
Count(ctx context.Context) (int64, error)
// Exists returns true if the result exists.
Exists(ctx context.Context) (bool, error)
}
SelectQueryExecutor is an interface that defines the methods for executing SELECT queries. It extends QueryExecutor with additional methods specific to SELECT operations.
type Selectable ¶
type Selectable[T QueryExecutor] interface { // SelectAll selects all columns. SelectAll() T // Select selects specific columns. Select(columns ...string) T // Exclude excludes specific columns. Exclude(columns ...string) T // ExcludeAll excludes all columns. ExcludeAll() T }
Selectable is an interface that defines the methods for column selection in queries. It provides methods to specify which columns to include or exclude from the result set.
type StatisticalAggregate ¶
type StatisticalAggregate[T any] interface { // Population configures the aggregate to use population statistics (e.g., STDDEV_POP). Population() T // Sample configures the aggregate to use sample statistics (e.g., STDDEV_SAMP). Sample() T }
StatisticalAggregate defines aggregate functions that support statistical modes.
type StatisticalMode ¶
type StatisticalMode int
StatisticalMode selects the statistical variant for aggregates.
const ( StatisticalDefault StatisticalMode = iota StatisticalPopulation // POP StatisticalSample // SAMP )
func (StatisticalMode) String ¶
func (s StatisticalMode) String() string
type StdDevBuilder ¶
type StdDevBuilder interface {
BaseAggregate[StdDevBuilder]
StatisticalAggregate[StdDevBuilder]
}
StdDevBuilder defines the STDDEV aggregate function builder.
type StringAggBuilder ¶
type StringAggBuilder interface {
BaseAggregate[StringAggBuilder]
DistinctableAggregate[StringAggBuilder]
OrderableAggregate[StringAggBuilder]
NullHandlingBuilder[StringAggBuilder]
Separator(separator string) StringAggBuilder
}
StringAggBuilder defines the STRING_AGG aggregate function builder.
type SumBuilder ¶
type SumBuilder interface {
BaseAggregate[SumBuilder]
DistinctableAggregate[SumBuilder]
}
SumBuilder defines the SUM aggregate function builder.
type TableSource ¶
type TableSource[T QueryExecutor] interface { // Model sets the primary table with automatic table name and alias resolution from model structure. Model(model any) T // ModelTable overrides the table name and alias auto-resolved by Model method. // It must be called after Model to manually specify the table name and alias. ModelTable(name string, alias ...string) T // Table sets a table using string name and optional alias directly. Table(name string, alias ...string) T // TableFrom sets a table by auto-resolving table name and alias from model. // The provided alias parameter takes precedence over the model's default alias. TableFrom(model any, alias ...string) T // TableExpr sets a table using a custom expression builder with optional alias. TableExpr(builder func(ExprBuilder) any, alias ...string) T // TableSubQuery sets a table using a subquery with optional alias. TableSubQuery(builder func(query SelectQuery), alias ...string) T }
TableSource is an interface that defines the methods for specifying table sources in queries. It supports both model-based and raw table references with optional aliases.
type Unwrapper ¶
type Unwrapper[T any] interface { // Unwrap returns the underlying query object. Unwrap() T }
Unwrapper is an interface that defines the method for unwrapping the underlying query object. It provides access to the original wrapped query implementation for advanced use cases.
type UpdateColumnHandler ¶ added in v0.7.1
type UpdateColumnHandler interface {
InsertColumnHandler
// OnUpdate is called when an existing record is being updated.
OnUpdate(query *BunUpdateQuery, table *schema.Table, field *schema.Field, model any, value reflect.Value)
}
UpdateColumnHandler is an interface for handlers that manage columns during both insert and update operations. It extends InsertHandler to also handle update scenarios with additional context.
type UpdateQuery ¶
type UpdateQuery interface {
QueryBuilder
QueryExecutor
DBAccessor
CTE[UpdateQuery]
TableSource[UpdateQuery]
Selectable[UpdateQuery]
Filterable[UpdateQuery]
Orderable[UpdateQuery]
Limitable[UpdateQuery]
ColumnUpdatable[UpdateQuery]
Returnable[UpdateQuery]
Applier[UpdateQuery]
// Set sets a column to a specific value (alias for Column).
Set(name string, value any) UpdateQuery
// SetExpr sets a column using an expression builder (alias for ColumnExpr).
SetExpr(name string, builder func(ExprBuilder) any) UpdateQuery
// OmitZero adds an omit zero clause to the query.
OmitZero() UpdateQuery
// Bulk adds a bulk clause to the query.
Bulk() UpdateQuery
}
UpdateQuery is an interface that defines the methods for building and executing UPDATE queries. It supports FROM clause for joining additional tables, conditions, column updates, and bulk operations. Note: UPDATE does not inherit JoinOperations directly; use From methods for PostgreSQL-style FROM clause.
type UpdatedAtHandler ¶ added in v0.7.1
type UpdatedAtHandler struct{}
UpdatedAtHandler implements UpdateHandler for automatically managing updated_at timestamps.
func (*UpdatedAtHandler) Name ¶ added in v0.7.1
func (*UpdatedAtHandler) Name() string
Name returns the column name for the updated_at field.
type UpdatedByHandler ¶ added in v0.7.1
type UpdatedByHandler struct{}
UpdatedByHandler implements UpdateHandler for automatically managing updated_by user information.
func (*UpdatedByHandler) Name ¶ added in v0.7.1
func (*UpdatedByHandler) Name() string
Name returns the column name for the updated_by field.
type VarianceBuilder ¶
type VarianceBuilder interface {
BaseAggregate[VarianceBuilder]
StatisticalAggregate[VarianceBuilder]
}
VarianceBuilder defines the VARIANCE aggregate function builder.
type WindowArrayAggBuilder ¶
type WindowArrayAggBuilder interface {
BaseAggregate[WindowArrayAggBuilder]
DistinctableAggregate[WindowArrayAggBuilder]
OrderableAggregate[WindowArrayAggBuilder]
NullHandlingBuilder[WindowArrayAggBuilder]
WindowPartitionable[WindowFrameablePartitionBuilder]
}
WindowArrayAggBuilder defines ARRAY_AGG() as window function builder.
type WindowAvgBuilder ¶
type WindowAvgBuilder interface {
BaseAggregate[WindowAvgBuilder]
DistinctableAggregate[WindowAvgBuilder]
WindowPartitionable[WindowFrameablePartitionBuilder]
}
WindowAvgBuilder defines AVG() as window function builder.
type WindowBitAndBuilder ¶
type WindowBitAndBuilder interface {
BaseAggregate[WindowBitAndBuilder]
WindowPartitionable[WindowFrameablePartitionBuilder]
}
WindowBitAndBuilder defines BIT_AND() as window function builder.
type WindowBitOrBuilder ¶
type WindowBitOrBuilder interface {
BaseAggregate[WindowBitOrBuilder]
WindowPartitionable[WindowFrameablePartitionBuilder]
}
WindowBitOrBuilder defines BIT_OR() as window function builder.
type WindowBoolAndBuilder ¶
type WindowBoolAndBuilder interface {
BaseAggregate[WindowBoolAndBuilder]
WindowPartitionable[WindowFrameablePartitionBuilder]
}
WindowBoolAndBuilder defines BOOL_AND() as window function builder.
type WindowBoolOrBuilder ¶
type WindowBoolOrBuilder interface {
BaseAggregate[WindowBoolOrBuilder]
WindowPartitionable[WindowFrameablePartitionBuilder]
}
WindowBoolOrBuilder defines BOOL_OR() as window function builder.
type WindowBoundable ¶
WindowBoundable defines window frame boundaries.
type WindowCountBuilder ¶
type WindowCountBuilder interface {
BaseAggregate[WindowCountBuilder]
DistinctableAggregate[WindowCountBuilder]
WindowPartitionable[WindowFrameablePartitionBuilder]
All() WindowCountBuilder
}
WindowCountBuilder defines COUNT() as window function builder.
type WindowEndBoundable ¶
type WindowEndBoundable[T any] interface { WindowStartBoundable[T] UnboundedFollowing() T }
WindowEndBoundable defines window frame end boundaries.
type WindowFrameBuilder ¶
type WindowFrameBuilder interface {
WindowStartBoundable[WindowFrameBuilder]
// And switches to configuring the end boundary for BETWEEN ... AND ... syntax.
And() WindowFrameEndBuilder
}
WindowFrameBuilder defines the window frame builder interface.
type WindowFrameEndBuilder ¶
type WindowFrameEndBuilder interface {
WindowEndBoundable[WindowFrameEndBuilder]
}
WindowFrameEndBuilder defines the window frame end boundary builder interface.
type WindowFrameablePartitionBuilder ¶
type WindowFrameablePartitionBuilder interface {
BaseWindowPartitionBuilder[WindowFrameablePartitionBuilder]
// Rows configures a ROWS frame clause.
Rows() WindowFrameBuilder
// Range configures a RANGE frame clause.
Range() WindowFrameBuilder
// Groups configures a GROUPS frame clause.
Groups() WindowFrameBuilder
}
WindowFrameablePartitionBuilder defines window functions that support partitioning and frame specification.
type WindowJSONArrayAggBuilder ¶
type WindowJSONArrayAggBuilder interface {
BaseAggregate[WindowJSONArrayAggBuilder]
DistinctableAggregate[WindowJSONArrayAggBuilder]
OrderableAggregate[WindowJSONArrayAggBuilder]
WindowPartitionable[WindowFrameablePartitionBuilder]
}
WindowJSONArrayAggBuilder defines JSON_ARRAY_AGG() as window function builder.
type WindowJSONObjectAggBuilder ¶
type WindowJSONObjectAggBuilder interface {
BaseAggregate[WindowJSONObjectAggBuilder]
DistinctableAggregate[WindowJSONObjectAggBuilder]
OrderableAggregate[WindowJSONObjectAggBuilder]
WindowPartitionable[WindowFrameablePartitionBuilder]
KeyColumn(column string) WindowJSONObjectAggBuilder
KeyExpr(expr any) WindowJSONObjectAggBuilder
}
WindowJSONObjectAggBuilder defines JSON_OBJECT_AGG() as window function builder.
type WindowMaxBuilder ¶
type WindowMaxBuilder interface {
BaseAggregate[WindowMaxBuilder]
WindowPartitionable[WindowFrameablePartitionBuilder]
}
WindowMaxBuilder defines MAX() as window function builder.
type WindowMinBuilder ¶
type WindowMinBuilder interface {
BaseAggregate[WindowMinBuilder]
WindowPartitionable[WindowFrameablePartitionBuilder]
}
WindowMinBuilder defines MIN() as window function builder.
type WindowPartitionBuilder ¶
type WindowPartitionBuilder interface {
BaseWindowPartitionBuilder[WindowPartitionBuilder]
}
WindowPartitionBuilder defines the window partition builder interface.
type WindowPartitionable ¶
type WindowPartitionable[T any] interface { // Over starts configuring the OVER clause for the window function. Over() T }
WindowPartitionable defines window functions that support partitioning.
type WindowStartBoundable ¶
type WindowStartBoundable[T any] interface { WindowBoundable[T] UnboundedPreceding() T }
WindowStartBoundable defines window frame start boundaries.
type WindowStdDevBuilder ¶
type WindowStdDevBuilder interface {
BaseAggregate[WindowStdDevBuilder]
StatisticalAggregate[WindowStdDevBuilder]
WindowPartitionable[WindowFrameablePartitionBuilder]
}
WindowStdDevBuilder defines STDDEV() as window function builder.
type WindowStringAggBuilder ¶
type WindowStringAggBuilder interface {
BaseAggregate[WindowStringAggBuilder]
DistinctableAggregate[WindowStringAggBuilder]
OrderableAggregate[WindowStringAggBuilder]
NullHandlingBuilder[WindowStringAggBuilder]
WindowPartitionable[WindowFrameablePartitionBuilder]
Separator(separator string) WindowStringAggBuilder
}
WindowStringAggBuilder defines STRING_AGG() as window function builder.
type WindowSumBuilder ¶
type WindowSumBuilder interface {
BaseAggregate[WindowSumBuilder]
DistinctableAggregate[WindowSumBuilder]
WindowPartitionable[WindowFrameablePartitionBuilder]
}
WindowSumBuilder defines SUM() as window function builder.
type WindowVarianceBuilder ¶
type WindowVarianceBuilder interface {
BaseAggregate[WindowVarianceBuilder]
StatisticalAggregate[WindowVarianceBuilder]
WindowPartitionable[WindowFrameablePartitionBuilder]
}
WindowVarianceBuilder defines VARIANCE() as window function builder.
Source Files
¶
- aggregate.go
- audit.go
- audit_timestamp.go
- audit_user.go
- case.go
- clause_condition.go
- condition.go
- conflict.go
- constants.go
- criteria.go
- db.go
- delete.go
- enums.go
- errors.go
- expr_builder.go
- expressions.go
- filter.go
- helpers.go
- id.go
- insert.go
- interfaces.go
- merge.go
- merge_when.go
- model.go
- module.go
- names.go
- order.go
- orm.go
- pk.go
- query_builder.go
- query_condition.go
- raw_query.go
- select.go
- update.go
- window.go