Documentation ¶
Index ¶
- Variables
- func InitializeRelationships(v any) error
- func Load(tx *sqlx.Tx, v any, relation string) error
- func LoadContext(ctx context.Context, tx *sqlx.Tx, v any, relation string) error
- func LoadMissing(tx *sqlx.Tx, v any, relation string) error
- func LoadMissingContext(ctx context.Context, tx *sqlx.Tx, v any, relation string) error
- func NewSelects() *selects
- type AfterLoader
- type AfterSaver
- type BeforeSaver
- type BelongsTo
- func (r BelongsTo) ForeignKeys() []*ForeignKey
- func (r *BelongsTo[T]) Initialize(parent any, field reflect.StructField) error
- func (r *BelongsTo[T]) Load(ctx context.Context, tx *sqlx.Tx, relations []Relationship) error
- func (v *BelongsTo) Loaded() bool
- func (v *BelongsTo) MarshalJSON() ([]byte, error)
- func (r BelongsTo) Subquery() *SubBuilder
- func (v *BelongsTo) Value() (T, bool)
- type Builder
- func (b *Builder[T]) AddGroupBy(columns ...string) *Builder[T]
- func (b *Builder[T]) AddSelect(columns ...string) *Builder[T]
- func (b *Builder[T]) AddSelectFunction(function, column string) *Builder[T]
- func (b *Builder[T]) AddSelectSubquery(sb QueryBuilder, as string) *Builder[T]
- func (b *Builder[T]) And(cb func(q *Conditions)) *Builder[T]
- func (b *Builder[T]) Clone() *Builder[T]
- func (b *Builder[T]) Context() context.Context
- func (b *Builder[T]) CrossJoin(table, localColumn, operator, foreignColumn string) *Builder[T]
- func (b *Builder[T]) CrossJoinOn(table string, cb func(q *Conditions)) *Builder[T]
- func (b *Builder[T]) Distinct() *Builder[T]
- func (b *Builder[T]) Dump() *Builder[T]
- func (b *Builder[T]) Find(tx *sqlx.Tx, primaryKeyValue any) (T, error)
- func (b *Builder[T]) First(tx *sqlx.Tx) (T, error)
- func (b *Builder[T]) From(table string) *Builder[T]
- func (b *Builder[T]) Get(tx *sqlx.Tx) ([]T, error)
- func (b *Builder[T]) GetTable() string
- func (b *Builder[T]) GroupBy(columns ...string) *Builder[T]
- func (b *Builder[T]) Having(column, operator string, value any) *Builder[T]
- func (b *Builder[T]) HavingAnd(cb func(q *Conditions)) *Builder[T]
- func (b *Builder[T]) HavingColumn(column, operator string, valueColumn string) *Builder[T]
- func (b *Builder[T]) HavingExists(query QueryBuilder) *Builder[T]
- func (b *Builder[T]) HavingHas(relation string, cb func(q *SubBuilder) *SubBuilder) *Builder[T]
- func (b *Builder[T]) HavingIn(column string, values []any) *Builder[T]
- func (b *Builder[T]) HavingOr(cb func(q *Conditions)) *Builder[T]
- func (b *Builder[T]) HavingRaw(rawSql string, bindings ...any) *Builder[T]
- func (b *Builder[T]) HavingSubquery(subquery QueryBuilder, operator string, value any) *Builder[T]
- func (b *Builder[T]) InnerJoin(table, localColumn, operator, foreignColumn string) *Builder[T]
- func (b *Builder[T]) InnerJoinOn(table string, cb func(q *Conditions)) *Builder[T]
- func (b *Builder[T]) Join(table, localColumn, operator, foreignColumn string) *Builder[T]
- func (b *Builder[T]) JoinOn(table string, cb func(q *Conditions)) *Builder[T]
- func (b *Builder[T]) LeftJoin(table, localColumn, operator, foreignColumn string) *Builder[T]
- func (b *Builder[T]) LeftJoinOn(table string, cb func(q *Conditions)) *Builder[T]
- func (b *Builder[T]) Limit(limit int) *Builder[T]
- func (b *Builder[T]) Load(tx *sqlx.Tx, v any) error
- func (b *Builder[T]) LoadOne(tx *sqlx.Tx, v any) error
- func (b *Builder[T]) Offset(offset int) *Builder[T]
- func (b *Builder[T]) Or(cb func(q *Conditions)) *Builder[T]
- func (b *Builder[T]) OrHaving(column, operator string, value any) *Builder[T]
- func (b *Builder[T]) OrHavingColumn(column, operator string, valueColumn string) *Builder[T]
- func (b *Builder[T]) OrHavingExists(query QueryBuilder) *Builder[T]
- func (b *Builder[T]) OrHavingHas(relation string, cb func(q *SubBuilder) *SubBuilder) *Builder[T]
- func (b *Builder[T]) OrHavingIn(column string, values []any) *Builder[T]
- func (b *Builder[T]) OrHavingRaw(rawSql string, bindings ...any) *Builder[T]
- func (b *Builder[T]) OrHavingSubquery(subquery QueryBuilder, operator string, value any) *Builder[T]
- func (b *Builder[T]) OrWhere(column, operator string, value any) *Builder[T]
- func (b *Builder[T]) OrWhereColumn(column, operator string, valueColumn string) *Builder[T]
- func (b *Builder[T]) OrWhereExists(query QueryBuilder) *Builder[T]
- func (b *Builder[T]) OrWhereHas(relation string, cb func(q *SubBuilder) *SubBuilder) *Builder[T]
- func (b *Builder[T]) OrWhereIn(column string, values []any) *Builder[T]
- func (b *Builder[T]) OrWhereRaw(rawSql string, bindings ...any) *Builder[T]
- func (b *Builder[T]) OrWhereSubquery(subquery QueryBuilder, operator string, value any) *Builder[T]
- func (b *Builder[T]) OrderBy(column string) *Builder[T]
- func (b *Builder[T]) OrderByDesc(column string) *Builder[T]
- func (b *Builder[T]) RightJoin(table, localColumn, operator, foreignColumn string) *Builder[T]
- func (b *Builder[T]) RightJoinOn(table string, cb func(q *Conditions)) *Builder[T]
- func (b *Builder[T]) Select(columns ...string) *Builder[T]
- func (b *Builder[T]) SelectFunction(function, column string) *Builder[T]
- func (b *Builder[T]) SelectSubquery(sb QueryBuilder, as string) *Builder[T]
- func (b *Builder[T]) ToSQL(d dialects.Dialect) (string, []any, error)
- func (b *Builder[T]) Where(column, operator string, value any) *Builder[T]
- func (b *Builder[T]) WhereColumn(column, operator string, valueColumn string) *Builder[T]
- func (b *Builder[T]) WhereExists(query QueryBuilder) *Builder[T]
- func (b *Builder[T]) WhereHas(relation string, cb func(q *SubBuilder) *SubBuilder) *Builder[T]
- func (b *Builder[T]) WhereIn(column string, values []any) *Builder[T]
- func (b *Builder[T]) WhereRaw(rawSql string, bindings ...any) *Builder[T]
- func (b *Builder[T]) WhereSubquery(subquery QueryBuilder, operator string, value any) *Builder[T]
- func (b *Builder[T]) With(withs ...string) *Builder[T]
- func (b *Builder[T]) WithContext(ctx context.Context) *Builder[T]
- func (b *Builder[T]) WithScope(scope *Scope) *Builder[T]
- func (b *Builder[T]) WithoutGlobalScope(scope *Scope) *Builder[T]
- func (b *Builder[T]) WithoutScope(scope *Scope) *Builder[T]
- type Conditions
- func (c *Conditions) And(cb func(q *Conditions)) *Conditions
- func (c *Conditions) Clone() *Conditions
- func (c *Conditions) Or(cb func(q *Conditions)) *Conditions
- func (c *Conditions) OrWhere(column, operator string, value any) *Conditions
- func (c *Conditions) OrWhereColumn(column, operator string, valueColumn string) *Conditions
- func (c *Conditions) OrWhereExists(query QueryBuilder) *Conditions
- func (c *Conditions) OrWhereHas(relation string, cb func(q *SubBuilder) *SubBuilder) *Conditions
- func (c *Conditions) OrWhereIn(column string, values []any) *Conditions
- func (c *Conditions) OrWhereRaw(rawSql string, bindings ...any) *Conditions
- func (c *Conditions) OrWhereSubquery(subquery QueryBuilder, operator string, value any) *Conditions
- func (c *Conditions) ToSQL(d dialects.Dialect) (string, []any, error)
- func (c *Conditions) Where(column, operator string, value any) *Conditions
- func (c *Conditions) WhereColumn(column, operator string, valueColumn string) *Conditions
- func (c *Conditions) WhereExists(query QueryBuilder) *Conditions
- func (c *Conditions) WhereHas(relation string, cb func(q *SubBuilder) *SubBuilder) *Conditions
- func (c *Conditions) WhereIn(column string, values []any) *Conditions
- func (c *Conditions) WhereRaw(rawSql string, bindings ...any) *Conditions
- func (c *Conditions) WhereSubquery(subquery QueryBuilder, operator string, value any) *Conditions
- type ForeignKey
- type HasMany
- func (r HasMany) ForeignKeys() []*ForeignKey
- func (r *HasMany[T]) Initialize(parent any, field reflect.StructField) error
- func (r *HasMany[T]) Load(ctx context.Context, tx *sqlx.Tx, relations []Relationship) error
- func (v *HasMany) Loaded() bool
- func (v *HasMany) MarshalJSON() ([]byte, error)
- func (r HasMany) Subquery() *SubBuilder
- func (v *HasMany) Value() (T, bool)
- type HasOne
- func (r HasOne) ForeignKeys() []*ForeignKey
- func (r *HasOne[T]) Initialize(parent any, field reflect.StructField) error
- func (r *HasOne[T]) Load(ctx context.Context, tx *sqlx.Tx, relations []Relationship) error
- func (v *HasOne) Loaded() bool
- func (v *HasOne) MarshalJSON() ([]byte, error)
- func (r HasOne) Subquery() *SubBuilder
- func (v *HasOne) Value() (T, bool)
- type QueryBuilder
- type Relationship
- type Scope
- type ScopeFunc
- type Scoper
- type SubBuilder
- func (b *SubBuilder) AddGroupBy(columns ...string) *SubBuilder
- func (b *SubBuilder) AddSelect(columns ...string) *SubBuilder
- func (b *SubBuilder) AddSelectFunction(function, column string) *SubBuilder
- func (b *SubBuilder) AddSelectSubquery(sb QueryBuilder, as string) *SubBuilder
- func (b *SubBuilder) And(cb func(q *Conditions)) *SubBuilder
- func (b *SubBuilder) Clone() *SubBuilder
- func (b *SubBuilder) Context() context.Context
- func (b *SubBuilder) CrossJoin(table, localColumn, operator, foreignColumn string) *SubBuilder
- func (b *SubBuilder) CrossJoinOn(table string, cb func(q *Conditions)) *SubBuilder
- func (b *SubBuilder) Distinct() *SubBuilder
- func (b *SubBuilder) Dump() *SubBuilder
- func (b *SubBuilder) From(table string) *SubBuilder
- func (b *SubBuilder) GetTable() string
- func (b *SubBuilder) GroupBy(columns ...string) *SubBuilder
- func (b *SubBuilder) Having(column, operator string, value any) *SubBuilder
- func (b *SubBuilder) HavingAnd(cb func(q *Conditions)) *SubBuilder
- func (b *SubBuilder) HavingColumn(column, operator string, valueColumn string) *SubBuilder
- func (b *SubBuilder) HavingExists(query QueryBuilder) *SubBuilder
- func (b *SubBuilder) HavingHas(relation string, cb func(q *SubBuilder) *SubBuilder) *SubBuilder
- func (b *SubBuilder) HavingIn(column string, values []any) *SubBuilder
- func (b *SubBuilder) HavingOr(cb func(q *Conditions)) *SubBuilder
- func (b *SubBuilder) HavingRaw(rawSql string, bindings ...any) *SubBuilder
- func (b *SubBuilder) HavingSubquery(subquery QueryBuilder, operator string, value any) *SubBuilder
- func (b *SubBuilder) InnerJoin(table, localColumn, operator, foreignColumn string) *SubBuilder
- func (b *SubBuilder) InnerJoinOn(table string, cb func(q *Conditions)) *SubBuilder
- func (b *SubBuilder) Join(table, localColumn, operator, foreignColumn string) *SubBuilder
- func (b *SubBuilder) JoinOn(table string, cb func(q *Conditions)) *SubBuilder
- func (b *SubBuilder) LeftJoin(table, localColumn, operator, foreignColumn string) *SubBuilder
- func (b *SubBuilder) LeftJoinOn(table string, cb func(q *Conditions)) *SubBuilder
- func (b *SubBuilder) Limit(limit int) *SubBuilder
- func (b *SubBuilder) Offset(offset int) *SubBuilder
- func (b *SubBuilder) Or(cb func(q *Conditions)) *SubBuilder
- func (b *SubBuilder) OrHaving(column, operator string, value any) *SubBuilder
- func (b *SubBuilder) OrHavingColumn(column, operator string, valueColumn string) *SubBuilder
- func (b *SubBuilder) OrHavingExists(query QueryBuilder) *SubBuilder
- func (b *SubBuilder) OrHavingHas(relation string, cb func(q *SubBuilder) *SubBuilder) *SubBuilder
- func (b *SubBuilder) OrHavingIn(column string, values []any) *SubBuilder
- func (b *SubBuilder) OrHavingRaw(rawSql string, bindings ...any) *SubBuilder
- func (b *SubBuilder) OrHavingSubquery(subquery QueryBuilder, operator string, value any) *SubBuilder
- func (b *SubBuilder) OrWhere(column, operator string, value any) *SubBuilder
- func (b *SubBuilder) OrWhereColumn(column, operator string, valueColumn string) *SubBuilder
- func (b *SubBuilder) OrWhereExists(query QueryBuilder) *SubBuilder
- func (b *SubBuilder) OrWhereHas(relation string, cb func(q *SubBuilder) *SubBuilder) *SubBuilder
- func (b *SubBuilder) OrWhereIn(column string, values []any) *SubBuilder
- func (b *SubBuilder) OrWhereRaw(rawSql string, bindings ...any) *SubBuilder
- func (b *SubBuilder) OrWhereSubquery(subquery QueryBuilder, operator string, value any) *SubBuilder
- func (b *SubBuilder) OrderBy(column string) *SubBuilder
- func (b *SubBuilder) OrderByDesc(column string) *SubBuilder
- func (b *SubBuilder) RightJoin(table, localColumn, operator, foreignColumn string) *SubBuilder
- func (b *SubBuilder) RightJoinOn(table string, cb func(q *Conditions)) *SubBuilder
- func (b *SubBuilder) Select(columns ...string) *SubBuilder
- func (b *SubBuilder) SelectFunction(function, column string) *SubBuilder
- func (b *SubBuilder) SelectSubquery(sb QueryBuilder, as string) *SubBuilder
- func (b *SubBuilder) ToSQL(d dialects.Dialect) (string, []any, error)
- func (b *SubBuilder) Where(column, operator string, value any) *SubBuilder
- func (b *SubBuilder) WhereColumn(column, operator string, valueColumn string) *SubBuilder
- func (b *SubBuilder) WhereExists(query QueryBuilder) *SubBuilder
- func (b *SubBuilder) WhereHas(relation string, cb func(q *SubBuilder) *SubBuilder) *SubBuilder
- func (b *SubBuilder) WhereIn(column string, values []any) *SubBuilder
- func (b *SubBuilder) WhereRaw(rawSql string, bindings ...any) *SubBuilder
- func (b *SubBuilder) WhereSubquery(subquery QueryBuilder, operator string, value any) *SubBuilder
- func (b *SubBuilder) WithContext(ctx context.Context) *SubBuilder
- func (b *SubBuilder) WithScope(scope *Scope) *SubBuilder
- func (b *SubBuilder) WithoutGlobalScope(scope *Scope) *SubBuilder
- func (b *SubBuilder) WithoutScope(scope *Scope) *SubBuilder
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrMissingRelationship = fmt.Errorf("missing relationship") ErrMissingField = fmt.Errorf("missing related field") )
Functions ¶
func InitializeRelationships ¶
func LoadContext ¶ added in v0.11.4
func LoadMissingContext ¶ added in v0.14.0
func NewSelects ¶
func NewSelects() *selects
Types ¶
type BeforeSaver ¶
type BelongsTo ¶
func (BelongsTo) ForeignKeys ¶ added in v0.16.5
func (r BelongsTo) ForeignKeys() []*ForeignKey
func (*BelongsTo[T]) Initialize ¶
func (r *BelongsTo[T]) Initialize(parent any, field reflect.StructField) error
func (*BelongsTo) MarshalJSON ¶
func (BelongsTo) Subquery ¶ added in v0.7.0
func (r BelongsTo) Subquery() *SubBuilder
type Builder ¶
func (*Builder[T]) AddGroupBy ¶
func (*Builder[T]) AddSelectFunction ¶ added in v0.4.1
func (*Builder[T]) AddSelectSubquery ¶
func (b *Builder[T]) AddSelectSubquery(sb QueryBuilder, as string) *Builder[T]
func (*Builder[T]) And ¶
func (b *Builder[T]) And(cb func(q *Conditions)) *Builder[T]
func (*Builder[T]) CrossJoinOn ¶ added in v0.16.0
func (b *Builder[T]) CrossJoinOn(table string, cb func(q *Conditions)) *Builder[T]
func (*Builder[T]) HavingAnd ¶
func (b *Builder[T]) HavingAnd(cb func(q *Conditions)) *Builder[T]
func (*Builder[T]) HavingColumn ¶ added in v0.4.0
func (*Builder[T]) HavingExists ¶ added in v0.4.0
func (b *Builder[T]) HavingExists(query QueryBuilder) *Builder[T]
func (*Builder[T]) HavingHas ¶ added in v0.7.0
func (b *Builder[T]) HavingHas(relation string, cb func(q *SubBuilder) *SubBuilder) *Builder[T]
func (*Builder[T]) HavingOr ¶
func (b *Builder[T]) HavingOr(cb func(q *Conditions)) *Builder[T]
func (*Builder[T]) HavingSubquery ¶ added in v0.6.0
func (b *Builder[T]) HavingSubquery(subquery QueryBuilder, operator string, value any) *Builder[T]
func (*Builder[T]) InnerJoinOn ¶ added in v0.16.0
func (b *Builder[T]) InnerJoinOn(table string, cb func(q *Conditions)) *Builder[T]
func (*Builder[T]) JoinOn ¶ added in v0.16.0
func (b *Builder[T]) JoinOn(table string, cb func(q *Conditions)) *Builder[T]
func (*Builder[T]) LeftJoinOn ¶ added in v0.16.0
func (b *Builder[T]) LeftJoinOn(table string, cb func(q *Conditions)) *Builder[T]
func (*Builder[T]) Or ¶
func (b *Builder[T]) Or(cb func(q *Conditions)) *Builder[T]
func (*Builder[T]) OrHavingColumn ¶ added in v0.4.0
func (*Builder[T]) OrHavingExists ¶ added in v0.4.0
func (b *Builder[T]) OrHavingExists(query QueryBuilder) *Builder[T]
func (*Builder[T]) OrHavingHas ¶ added in v0.7.0
func (b *Builder[T]) OrHavingHas(relation string, cb func(q *SubBuilder) *SubBuilder) *Builder[T]
func (*Builder[T]) OrHavingIn ¶ added in v0.4.0
func (*Builder[T]) OrHavingRaw ¶ added in v0.8.0
func (*Builder[T]) OrHavingSubquery ¶ added in v0.6.0
func (b *Builder[T]) OrHavingSubquery(subquery QueryBuilder, operator string, value any) *Builder[T]
func (*Builder[T]) OrWhereColumn ¶
func (*Builder[T]) OrWhereExists ¶ added in v0.4.0
func (b *Builder[T]) OrWhereExists(query QueryBuilder) *Builder[T]
func (*Builder[T]) OrWhereHas ¶ added in v0.7.0
func (b *Builder[T]) OrWhereHas(relation string, cb func(q *SubBuilder) *SubBuilder) *Builder[T]
func (*Builder[T]) OrWhereRaw ¶ added in v0.8.0
func (*Builder[T]) OrWhereSubquery ¶ added in v0.6.0
func (b *Builder[T]) OrWhereSubquery(subquery QueryBuilder, operator string, value any) *Builder[T]
func (*Builder[T]) OrderByDesc ¶ added in v0.4.2
func (*Builder[T]) RightJoinOn ¶ added in v0.16.0
func (b *Builder[T]) RightJoinOn(table string, cb func(q *Conditions)) *Builder[T]
func (*Builder[T]) SelectFunction ¶ added in v0.4.0
func (*Builder[T]) SelectSubquery ¶
func (b *Builder[T]) SelectSubquery(sb QueryBuilder, as string) *Builder[T]
func (*Builder[T]) WhereColumn ¶
func (*Builder[T]) WhereExists ¶ added in v0.4.0
func (b *Builder[T]) WhereExists(query QueryBuilder) *Builder[T]
func (*Builder[T]) WhereHas ¶ added in v0.7.0
func (b *Builder[T]) WhereHas(relation string, cb func(q *SubBuilder) *SubBuilder) *Builder[T]
func (*Builder[T]) WhereSubquery ¶ added in v0.6.0
func (b *Builder[T]) WhereSubquery(subquery QueryBuilder, operator string, value any) *Builder[T]
func (*Builder[T]) WithContext ¶ added in v0.10.0
func (*Builder[T]) WithoutGlobalScope ¶ added in v0.9.1
func (*Builder[T]) WithoutScope ¶ added in v0.9.0
type Conditions ¶ added in v0.16.0
type Conditions struct {
// contains filtered or unexported fields
}
func (*Conditions) And ¶ added in v0.16.0
func (c *Conditions) And(cb func(q *Conditions)) *Conditions
func (*Conditions) Clone ¶ added in v0.16.0
func (c *Conditions) Clone() *Conditions
func (*Conditions) Or ¶ added in v0.16.0
func (c *Conditions) Or(cb func(q *Conditions)) *Conditions
func (*Conditions) OrWhere ¶ added in v0.16.0
func (c *Conditions) OrWhere(column, operator string, value any) *Conditions
func (*Conditions) OrWhereColumn ¶ added in v0.16.0
func (c *Conditions) OrWhereColumn(column, operator string, valueColumn string) *Conditions
func (*Conditions) OrWhereExists ¶ added in v0.16.0
func (c *Conditions) OrWhereExists(query QueryBuilder) *Conditions
func (*Conditions) OrWhereHas ¶ added in v0.16.0
func (c *Conditions) OrWhereHas(relation string, cb func(q *SubBuilder) *SubBuilder) *Conditions
func (*Conditions) OrWhereIn ¶ added in v0.16.0
func (c *Conditions) OrWhereIn(column string, values []any) *Conditions
func (*Conditions) OrWhereRaw ¶ added in v0.16.0
func (c *Conditions) OrWhereRaw(rawSql string, bindings ...any) *Conditions
func (*Conditions) OrWhereSubquery ¶ added in v0.16.0
func (c *Conditions) OrWhereSubquery(subquery QueryBuilder, operator string, value any) *Conditions
func (*Conditions) Where ¶ added in v0.16.0
func (c *Conditions) Where(column, operator string, value any) *Conditions
func (*Conditions) WhereColumn ¶ added in v0.16.0
func (c *Conditions) WhereColumn(column, operator string, valueColumn string) *Conditions
func (*Conditions) WhereExists ¶ added in v0.16.0
func (c *Conditions) WhereExists(query QueryBuilder) *Conditions
func (*Conditions) WhereHas ¶ added in v0.16.0
func (c *Conditions) WhereHas(relation string, cb func(q *SubBuilder) *SubBuilder) *Conditions
func (*Conditions) WhereIn ¶ added in v0.16.0
func (c *Conditions) WhereIn(column string, values []any) *Conditions
func (*Conditions) WhereRaw ¶ added in v0.16.0
func (c *Conditions) WhereRaw(rawSql string, bindings ...any) *Conditions
func (*Conditions) WhereSubquery ¶ added in v0.16.0
func (c *Conditions) WhereSubquery(subquery QueryBuilder, operator string, value any) *Conditions
type ForeignKey ¶ added in v0.16.5
func (*ForeignKey) Equal ¶ added in v0.16.5
func (f *ForeignKey) Equal(v *ForeignKey) bool
type HasMany ¶
func (HasMany) ForeignKeys ¶ added in v0.16.5
func (r HasMany) ForeignKeys() []*ForeignKey
func (*HasMany[T]) Initialize ¶
func (r *HasMany[T]) Initialize(parent any, field reflect.StructField) error
func (*HasMany) MarshalJSON ¶
func (HasMany) Subquery ¶ added in v0.7.0
func (r HasMany) Subquery() *SubBuilder
type HasOne ¶
HasOne tags `local` `foreign`
func (HasOne) ForeignKeys ¶ added in v0.16.5
func (r HasOne) ForeignKeys() []*ForeignKey
func (*HasOne[T]) Initialize ¶
func (r *HasOne[T]) Initialize(parent any, field reflect.StructField) error
func (*HasOne) MarshalJSON ¶
func (HasOne) Subquery ¶ added in v0.7.0
func (r HasOne) Subquery() *SubBuilder
type QueryBuilder ¶ added in v0.4.1
type Relationship ¶
type Relationship interface { Subquery() *SubBuilder Initialize(self any, field reflect.StructField) error Load(ctx context.Context, tx *sqlx.Tx, relations []Relationship) error Loaded() bool ForeignKeys() []*ForeignKey }
type ScopeFunc ¶ added in v0.9.0
type ScopeFunc func(b *SubBuilder) *SubBuilder
type SubBuilder ¶ added in v0.7.0
type SubBuilder struct {
// contains filtered or unexported fields
}
func NewSubBuilder ¶ added in v0.7.0
func NewSubBuilder() *SubBuilder
func (*SubBuilder) AddGroupBy ¶ added in v0.7.0
func (b *SubBuilder) AddGroupBy(columns ...string) *SubBuilder
func (*SubBuilder) AddSelect ¶ added in v0.7.0
func (b *SubBuilder) AddSelect(columns ...string) *SubBuilder
func (*SubBuilder) AddSelectFunction ¶ added in v0.7.0
func (b *SubBuilder) AddSelectFunction(function, column string) *SubBuilder
func (*SubBuilder) AddSelectSubquery ¶ added in v0.7.0
func (b *SubBuilder) AddSelectSubquery(sb QueryBuilder, as string) *SubBuilder
func (*SubBuilder) And ¶ added in v0.7.0
func (b *SubBuilder) And(cb func(q *Conditions)) *SubBuilder
func (*SubBuilder) Clone ¶ added in v0.7.0
func (b *SubBuilder) Clone() *SubBuilder
func (*SubBuilder) Context ¶ added in v0.10.0
func (b *SubBuilder) Context() context.Context
func (*SubBuilder) CrossJoin ¶ added in v0.16.0
func (b *SubBuilder) CrossJoin(table, localColumn, operator, foreignColumn string) *SubBuilder
func (*SubBuilder) CrossJoinOn ¶ added in v0.16.0
func (b *SubBuilder) CrossJoinOn(table string, cb func(q *Conditions)) *SubBuilder
func (*SubBuilder) Distinct ¶ added in v0.7.0
func (b *SubBuilder) Distinct() *SubBuilder
func (*SubBuilder) Dump ¶ added in v0.7.0
func (b *SubBuilder) Dump() *SubBuilder
func (*SubBuilder) From ¶ added in v0.7.0
func (b *SubBuilder) From(table string) *SubBuilder
func (*SubBuilder) GetTable ¶ added in v0.16.1
func (b *SubBuilder) GetTable() string
func (*SubBuilder) GroupBy ¶ added in v0.7.0
func (b *SubBuilder) GroupBy(columns ...string) *SubBuilder
func (*SubBuilder) Having ¶ added in v0.7.0
func (b *SubBuilder) Having(column, operator string, value any) *SubBuilder
func (*SubBuilder) HavingAnd ¶ added in v0.7.0
func (b *SubBuilder) HavingAnd(cb func(q *Conditions)) *SubBuilder
func (*SubBuilder) HavingColumn ¶ added in v0.7.0
func (b *SubBuilder) HavingColumn(column, operator string, valueColumn string) *SubBuilder
func (*SubBuilder) HavingExists ¶ added in v0.7.0
func (b *SubBuilder) HavingExists(query QueryBuilder) *SubBuilder
func (*SubBuilder) HavingHas ¶ added in v0.7.0
func (b *SubBuilder) HavingHas(relation string, cb func(q *SubBuilder) *SubBuilder) *SubBuilder
func (*SubBuilder) HavingIn ¶ added in v0.7.0
func (b *SubBuilder) HavingIn(column string, values []any) *SubBuilder
func (*SubBuilder) HavingOr ¶ added in v0.7.0
func (b *SubBuilder) HavingOr(cb func(q *Conditions)) *SubBuilder
func (*SubBuilder) HavingRaw ¶ added in v0.8.0
func (b *SubBuilder) HavingRaw(rawSql string, bindings ...any) *SubBuilder
func (*SubBuilder) HavingSubquery ¶ added in v0.7.0
func (b *SubBuilder) HavingSubquery(subquery QueryBuilder, operator string, value any) *SubBuilder
func (*SubBuilder) InnerJoin ¶ added in v0.16.0
func (b *SubBuilder) InnerJoin(table, localColumn, operator, foreignColumn string) *SubBuilder
func (*SubBuilder) InnerJoinOn ¶ added in v0.16.0
func (b *SubBuilder) InnerJoinOn(table string, cb func(q *Conditions)) *SubBuilder
func (*SubBuilder) Join ¶ added in v0.16.0
func (b *SubBuilder) Join(table, localColumn, operator, foreignColumn string) *SubBuilder
func (*SubBuilder) JoinOn ¶ added in v0.16.0
func (b *SubBuilder) JoinOn(table string, cb func(q *Conditions)) *SubBuilder
func (*SubBuilder) LeftJoin ¶ added in v0.16.0
func (b *SubBuilder) LeftJoin(table, localColumn, operator, foreignColumn string) *SubBuilder
func (*SubBuilder) LeftJoinOn ¶ added in v0.16.0
func (b *SubBuilder) LeftJoinOn(table string, cb func(q *Conditions)) *SubBuilder
func (*SubBuilder) Limit ¶ added in v0.7.0
func (b *SubBuilder) Limit(limit int) *SubBuilder
func (*SubBuilder) Offset ¶ added in v0.7.0
func (b *SubBuilder) Offset(offset int) *SubBuilder
func (*SubBuilder) Or ¶ added in v0.7.0
func (b *SubBuilder) Or(cb func(q *Conditions)) *SubBuilder
func (*SubBuilder) OrHaving ¶ added in v0.7.0
func (b *SubBuilder) OrHaving(column, operator string, value any) *SubBuilder
func (*SubBuilder) OrHavingColumn ¶ added in v0.7.0
func (b *SubBuilder) OrHavingColumn(column, operator string, valueColumn string) *SubBuilder
func (*SubBuilder) OrHavingExists ¶ added in v0.7.0
func (b *SubBuilder) OrHavingExists(query QueryBuilder) *SubBuilder
func (*SubBuilder) OrHavingHas ¶ added in v0.7.0
func (b *SubBuilder) OrHavingHas(relation string, cb func(q *SubBuilder) *SubBuilder) *SubBuilder
func (*SubBuilder) OrHavingIn ¶ added in v0.7.0
func (b *SubBuilder) OrHavingIn(column string, values []any) *SubBuilder
func (*SubBuilder) OrHavingRaw ¶ added in v0.8.0
func (b *SubBuilder) OrHavingRaw(rawSql string, bindings ...any) *SubBuilder
func (*SubBuilder) OrHavingSubquery ¶ added in v0.7.0
func (b *SubBuilder) OrHavingSubquery(subquery QueryBuilder, operator string, value any) *SubBuilder
func (*SubBuilder) OrWhere ¶ added in v0.7.0
func (b *SubBuilder) OrWhere(column, operator string, value any) *SubBuilder
func (*SubBuilder) OrWhereColumn ¶ added in v0.7.0
func (b *SubBuilder) OrWhereColumn(column, operator string, valueColumn string) *SubBuilder
func (*SubBuilder) OrWhereExists ¶ added in v0.7.0
func (b *SubBuilder) OrWhereExists(query QueryBuilder) *SubBuilder
func (*SubBuilder) OrWhereHas ¶ added in v0.7.0
func (b *SubBuilder) OrWhereHas(relation string, cb func(q *SubBuilder) *SubBuilder) *SubBuilder
func (*SubBuilder) OrWhereIn ¶ added in v0.7.0
func (b *SubBuilder) OrWhereIn(column string, values []any) *SubBuilder
func (*SubBuilder) OrWhereRaw ¶ added in v0.8.0
func (b *SubBuilder) OrWhereRaw(rawSql string, bindings ...any) *SubBuilder
func (*SubBuilder) OrWhereSubquery ¶ added in v0.7.0
func (b *SubBuilder) OrWhereSubquery(subquery QueryBuilder, operator string, value any) *SubBuilder
func (*SubBuilder) OrderBy ¶ added in v0.7.0
func (b *SubBuilder) OrderBy(column string) *SubBuilder
func (*SubBuilder) OrderByDesc ¶ added in v0.7.0
func (b *SubBuilder) OrderByDesc(column string) *SubBuilder
func (*SubBuilder) RightJoin ¶ added in v0.16.0
func (b *SubBuilder) RightJoin(table, localColumn, operator, foreignColumn string) *SubBuilder
func (*SubBuilder) RightJoinOn ¶ added in v0.16.0
func (b *SubBuilder) RightJoinOn(table string, cb func(q *Conditions)) *SubBuilder
func (*SubBuilder) Select ¶ added in v0.7.0
func (b *SubBuilder) Select(columns ...string) *SubBuilder
func (*SubBuilder) SelectFunction ¶ added in v0.7.0
func (b *SubBuilder) SelectFunction(function, column string) *SubBuilder
func (*SubBuilder) SelectSubquery ¶ added in v0.7.0
func (b *SubBuilder) SelectSubquery(sb QueryBuilder, as string) *SubBuilder
func (*SubBuilder) Where ¶ added in v0.7.0
func (b *SubBuilder) Where(column, operator string, value any) *SubBuilder
func (*SubBuilder) WhereColumn ¶ added in v0.7.0
func (b *SubBuilder) WhereColumn(column, operator string, valueColumn string) *SubBuilder
func (*SubBuilder) WhereExists ¶ added in v0.7.0
func (b *SubBuilder) WhereExists(query QueryBuilder) *SubBuilder
func (*SubBuilder) WhereHas ¶ added in v0.7.0
func (b *SubBuilder) WhereHas(relation string, cb func(q *SubBuilder) *SubBuilder) *SubBuilder
func (*SubBuilder) WhereIn ¶ added in v0.7.0
func (b *SubBuilder) WhereIn(column string, values []any) *SubBuilder
func (*SubBuilder) WhereRaw ¶ added in v0.8.0
func (b *SubBuilder) WhereRaw(rawSql string, bindings ...any) *SubBuilder
func (*SubBuilder) WhereSubquery ¶ added in v0.7.0
func (b *SubBuilder) WhereSubquery(subquery QueryBuilder, operator string, value any) *SubBuilder
func (*SubBuilder) WithContext ¶ added in v0.10.0
func (b *SubBuilder) WithContext(ctx context.Context) *SubBuilder
func (*SubBuilder) WithScope ¶ added in v0.9.0
func (b *SubBuilder) WithScope(scope *Scope) *SubBuilder
func (*SubBuilder) WithoutGlobalScope ¶ added in v0.9.3
func (b *SubBuilder) WithoutGlobalScope(scope *Scope) *SubBuilder
func (*SubBuilder) WithoutScope ¶ added in v0.9.0
func (b *SubBuilder) WithoutScope(scope *Scope) *SubBuilder
Source Files ¶
- belongs-to-one.go
- builder.go
- clone.go
- context.go
- from.go
- generated_Builder.go
- generated_SubBuilder.go
- get.go
- group-by.go
- has-many.go
- has-one-or-many.go
- has-one.go
- hooks.go
- join.go
- limit.go
- order-by.go
- relationship-init.go
- relationship-load.go
- relationship.go
- scope.go
- select.go
- to-sql.go
- util.go
- where-list.go
- with.go
Click to show internal directories.
Click to hide internal directories.