dialect

package
v0.50.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 8 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Dialect dialect

Functions

func BKA

func BKA[Q hintable](tables ...string) bob.Mod[Q]

func BNL

func BNL[Q hintable](tables ...string) bob.Mod[Q]

func DerivedConditionPushdown

func DerivedConditionPushdown[Q hintable](tables ...string) bob.Mod[Q]

func GroupIndex

func GroupIndex[Q hintable](tables ...string) bob.Mod[Q]

func HashJoin

func HashJoin[Q hintable](tables ...string) bob.Mod[Q]

func Index

func Index[Q hintable](tables ...string) bob.Mod[Q]

func IndexMerge

func IndexMerge[Q hintable](tables ...string) bob.Mod[Q]

func JoinFixedOrder

func JoinFixedOrder[Q hintable](name string) bob.Mod[Q]

func JoinIndex

func JoinIndex[Q hintable](tables ...string) bob.Mod[Q]

func JoinOrder

func JoinOrder[Q hintable](tables ...string) bob.Mod[Q]

func JoinPrefix

func JoinPrefix[Q hintable](tables ...string) bob.Mod[Q]

func JoinSuffix

func JoinSuffix[Q hintable](tables ...string) bob.Mod[Q]

func MRR

func MRR[Q hintable](tables ...string) bob.Mod[Q]

func MaxExecutionTime

func MaxExecutionTime[Q hintable](n int) bob.Mod[Q]

func Merge

func Merge[Q hintable](tables ...string) bob.Mod[Q]

func NoBKA

func NoBKA[Q hintable](tables ...string) bob.Mod[Q]

func NoBNL

func NoBNL[Q hintable](tables ...string) bob.Mod[Q]

func NoDerivedConditionPushdown

func NoDerivedConditionPushdown[Q hintable](tables ...string) bob.Mod[Q]

func NoGroupIndex

func NoGroupIndex[Q hintable](tables ...string) bob.Mod[Q]

func NoHashJoin

func NoHashJoin[Q hintable](tables ...string) bob.Mod[Q]

func NoICP

func NoICP[Q hintable](tables ...string) bob.Mod[Q]

func NoIndex

func NoIndex[Q hintable](tables ...string) bob.Mod[Q]

func NoIndexMerge

func NoIndexMerge[Q hintable](tables ...string) bob.Mod[Q]

func NoJoinIndex

func NoJoinIndex[Q hintable](tables ...string) bob.Mod[Q]

func NoMRR

func NoMRR[Q hintable](tables ...string) bob.Mod[Q]

func NoMerge

func NoMerge[Q hintable](tables ...string) bob.Mod[Q]

func NoOrderIndex

func NoOrderIndex[Q hintable](tables ...string) bob.Mod[Q]

func NoRangeOptimazation

func NoRangeOptimazation[Q hintable](tables ...string) bob.Mod[Q]

func NoSemijoin

func NoSemijoin[Q hintable](strategy ...string) bob.Mod[Q]

func NoSkipScan

func NoSkipScan[Q hintable](tables ...string) bob.Mod[Q]

func OrderIndex

func OrderIndex[Q hintable](tables ...string) bob.Mod[Q]

func Partition

func Partition[Q interface{ AppendPartition(...string) }](partitions ...string) bob.Mod[Q]

func QBName

func QBName[Q hintable](name string) bob.Mod[Q]

func ResourceGroup

func ResourceGroup[Q hintable](name string) bob.Mod[Q]

func Semijoin

func Semijoin[Q hintable](strategy ...string) bob.Mod[Q]

func SetVar

func SetVar[Q hintable](statement string) bob.Mod[Q]

func SkipScan

func SkipScan[Q hintable](tables ...string) bob.Mod[Q]

func Subquery

func Subquery[Q hintable](strategy string) bob.Mod[Q]

Types

type CTEChain

type CTEChain[Q interface{ AppendCTE(bob.Expression) }] func() clause.CTE

func With

func With[Q interface{ AppendCTE(bob.Expression) }](name string, columns ...string) CTEChain[Q]

func (CTEChain[Q]) Apply

func (c CTEChain[Q]) Apply(q Q)

func (CTEChain[Q]) As

func (c CTEChain[Q]) As(q bob.Query) CTEChain[Q]

type DeleteQuery added in v0.15.0

type DeleteQuery struct {
	clause.With

	Tables []clause.TableRef

	// This is needed since Paritions come AFTER the table alias in DELETE statements
	// In other statements, they come before the table alias
	Partitions []string

	clause.TableRef
	clause.Where
	clause.OrderBy
	clause.Limit
	bob.Load
	bob.EmbeddedHook
	bob.ContextualModdable[*DeleteQuery]
	// contains filtered or unexported fields
}

Trying to represent the query structure as documented in https://dev.mysql.com/doc/refman/8.0/en/delete.html

func (*DeleteQuery) AppendHint added in v0.15.0

func (h *DeleteQuery) AppendHint(hint string)

func (*DeleteQuery) AppendModifier added in v0.15.0

func (h *DeleteQuery) AppendModifier(modifier T)

func (*DeleteQuery) AppendPartition added in v0.35.0

func (d *DeleteQuery) AppendPartition(partitions ...string)

func (*DeleteQuery) AppendTable added in v0.35.0

func (d *DeleteQuery) AppendTable(expr bob.Expression)

func (DeleteQuery) WriteSQL added in v0.15.0

func (d DeleteQuery) WriteSQL(ctx context.Context, w io.StringWriter, dl bob.Dialect, start int) ([]any, error)

type Expression

type Expression struct {
	expr.Chain[Expression, Expression]
}

func (Expression) New

func (Expression) String

func (x Expression) String() string

Implements fmt.Stringer()

type FromChain added in v0.7.0

type FromChain[Q fromable] func() clause.TableRef

func From added in v0.7.0

func From[Q fromable](table any) FromChain[Q]

func (FromChain[Q]) Apply added in v0.7.0

func (f FromChain[Q]) Apply(q Q)

func (FromChain[Q]) As added in v0.7.0

func (f FromChain[Q]) As(alias string, columns ...string) FromChain[Q]

func (FromChain[Q]) ForceIndex added in v0.7.0

func (f FromChain[Q]) ForceIndex(first string, others ...string) FromChain[Q]

func (FromChain[Q]) ForceIndexForGroupBy added in v0.7.0

func (f FromChain[Q]) ForceIndexForGroupBy(first string, others ...string) FromChain[Q]

func (FromChain[Q]) ForceIndexForJoin added in v0.7.0

func (f FromChain[Q]) ForceIndexForJoin(first string, others ...string) FromChain[Q]

func (FromChain[Q]) ForceIndexForOrderBy added in v0.7.0

func (f FromChain[Q]) ForceIndexForOrderBy(first string, others ...string) FromChain[Q]

func (FromChain[Q]) IgnoreIndex added in v0.7.0

func (f FromChain[Q]) IgnoreIndex(first string, others ...string) FromChain[Q]

func (FromChain[Q]) IgnoreIndexForGroupBy added in v0.7.0

func (f FromChain[Q]) IgnoreIndexForGroupBy(first string, others ...string) FromChain[Q]

func (FromChain[Q]) IgnoreIndexForJoin added in v0.7.0

func (f FromChain[Q]) IgnoreIndexForJoin(first string, others ...string) FromChain[Q]

func (FromChain[Q]) IgnoreIndexForOrderBy added in v0.7.0

func (f FromChain[Q]) IgnoreIndexForOrderBy(first string, others ...string) FromChain[Q]

func (FromChain[Q]) Lateral added in v0.7.0

func (f FromChain[Q]) Lateral() FromChain[Q]

func (FromChain[Q]) Partition added in v0.7.0

func (f FromChain[Q]) Partition(partitions ...string) FromChain[Q]

func (FromChain[Q]) UseIndex added in v0.7.0

func (f FromChain[Q]) UseIndex(first string, others ...string) FromChain[Q]

func (FromChain[Q]) UseIndexForGroupBy added in v0.7.0

func (f FromChain[Q]) UseIndexForGroupBy(first string, others ...string) FromChain[Q]

func (FromChain[Q]) UseIndexForJoin added in v0.7.0

func (f FromChain[Q]) UseIndexForJoin(first string, others ...string) FromChain[Q]

func (FromChain[Q]) UseIndexForOrderBy added in v0.7.0

func (f FromChain[Q]) UseIndexForOrderBy(first string, others ...string) FromChain[Q]

type Function

type Function struct {

	// Used in value functions. Supported by Sqlite and Postgres
	Distinct bool
	clause.OrderBy
	Filter []any

	// For chain methods
	expr.Chain[Expression, Expression]
	// contains filtered or unexported fields
}

func NewFunction

func NewFunction(name any, args ...any) *Function

func (*Function) SetWindow added in v0.27.0

func (f *Function) SetWindow(w clause.Window)

func (Function) WriteSQL

func (f Function) WriteSQL(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error)

type IndexHintChain

type IndexHintChain[Q interface{ AppendIndexHint(clause.IndexHint) }] struct {
	// contains filtered or unexported fields
}

func (*IndexHintChain[Q]) Apply

func (i *IndexHintChain[Q]) Apply(q Q)

func (*IndexHintChain[Q]) ForGroupBy

func (i *IndexHintChain[Q]) ForGroupBy() *IndexHintChain[Q]

func (*IndexHintChain[Q]) ForJoin

func (i *IndexHintChain[Q]) ForJoin() *IndexHintChain[Q]

func (*IndexHintChain[Q]) ForOrderBy

func (i *IndexHintChain[Q]) ForOrderBy() *IndexHintChain[Q]

type InsertQuery added in v0.15.0

type InsertQuery struct {
	clause.TableRef
	clause.Values

	RowAlias    string
	ColumnAlias []string

	Sets               []Set
	DuplicateKeyUpdate clause.Set

	bob.Load
	bob.EmbeddedHook
	bob.ContextualModdable[*InsertQuery]
	// contains filtered or unexported fields
}

Trying to represent the query structure as documented in https://dev.mysql.com/doc/refman/8.0/en/insert.html

func (*InsertQuery) AppendHint added in v0.15.0

func (h *InsertQuery) AppendHint(hint string)

func (*InsertQuery) AppendModifier added in v0.15.0

func (h *InsertQuery) AppendModifier(modifier T)

func (InsertQuery) WriteSQL added in v0.15.0

func (i InsertQuery) WriteSQL(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error)

type JoinChain

type JoinChain[Q Joinable] func() clause.Join

func CrossJoin

func CrossJoin[Q Joinable](e any) JoinChain[Q]

func InnerJoin

func InnerJoin[Q Joinable](e any) JoinChain[Q]

func Join added in v0.17.0

func Join[Q Joinable](typ string, e any) JoinChain[Q]

func LeftJoin

func LeftJoin[Q Joinable](e any) JoinChain[Q]

func RightJoin

func RightJoin[Q Joinable](e any) JoinChain[Q]

func StraightJoin

func StraightJoin[Q Joinable](e any) JoinChain[Q]

func (JoinChain[Q]) Apply

func (j JoinChain[Q]) Apply(q Q)

func (JoinChain[Q]) As

func (f JoinChain[Q]) As(alias string, columns ...string) JoinChain[Q]

func (JoinChain[Q]) Lateral added in v0.20.0

func (f JoinChain[Q]) Lateral() JoinChain[Q]

func (JoinChain[Q]) Natural

func (j JoinChain[Q]) Natural() bob.Mod[Q]

func (JoinChain[Q]) On

func (j JoinChain[Q]) On(on ...bob.Expression) bob.Mod[Q]

func (JoinChain[Q]) OnEQ

func (j JoinChain[Q]) OnEQ(a, b bob.Expression) bob.Mod[Q]

func (JoinChain[Q]) Partition added in v0.20.0

func (f JoinChain[Q]) Partition(partitions ...string) JoinChain[Q]

func (JoinChain[Q]) Using

func (j JoinChain[Q]) Using(using ...string) bob.Mod[Q]

type Joinable added in v0.17.0

type Joinable interface{ AppendJoin(clause.Join) }

type LockChain

type LockChain[Q interface{ AppendLock(bob.Expression) }] func() clause.Lock

func (LockChain[Q]) Apply

func (l LockChain[Q]) Apply(q Q)

func (LockChain[Q]) NoWait

func (l LockChain[Q]) NoWait() LockChain[Q]

func (LockChain[Q]) SkipLocked

func (l LockChain[Q]) SkipLocked() LockChain[Q]

type OrderBy

type OrderBy[Q interface{ AppendOrder(bob.Expression) }] func() clause.OrderDef

func (OrderBy[Q]) Apply

func (s OrderBy[Q]) Apply(q Q)

func (OrderBy[Q]) Asc

func (o OrderBy[Q]) Asc() OrderBy[Q]

func (OrderBy[Q]) Collate

func (o OrderBy[Q]) Collate(collationName string) OrderBy[Q]

func (OrderBy[Q]) Desc

func (o OrderBy[Q]) Desc() OrderBy[Q]

type OrderCombined added in v0.35.0

type OrderCombined OrderBy[*SelectQuery]

func (OrderCombined) Apply added in v0.35.0

func (o OrderCombined) Apply(q *SelectQuery)

func (OrderCombined) Asc added in v0.46.0

func (o OrderCombined) Asc() OrderCombined

func (OrderCombined) Collate added in v0.46.0

func (o OrderCombined) Collate(collationName string) OrderCombined

func (OrderCombined) Desc added in v0.46.0

func (o OrderCombined) Desc() OrderCombined

type SelectQuery added in v0.15.0

Trying to represent the query structure as documented in https://dev.mysql.com/doc/refman/8.0/en/select.html

func (*SelectQuery) AppendHint added in v0.15.0

func (h *SelectQuery) AppendHint(hint string)

func (*SelectQuery) AppendModifier added in v0.15.0

func (h *SelectQuery) AppendModifier(modifier T)

func (*SelectQuery) SetInto added in v0.15.0

func (s *SelectQuery) SetInto(i any)

func (SelectQuery) WriteSQL added in v0.15.0

func (s SelectQuery) WriteSQL(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error)

type Set added in v0.15.0

type Set struct {
	Col string
	Val any
}

func (Set) WriteSQL added in v0.15.0

func (s Set) WriteSQL(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error)

type UpdateQuery added in v0.15.0

type UpdateQuery struct {
	clause.With
	clause.Set
	clause.TableRef
	clause.Where
	clause.OrderBy
	clause.Limit
	bob.Load
	bob.EmbeddedHook
	bob.ContextualModdable[*UpdateQuery]
	// contains filtered or unexported fields
}

Trying to represent the select query structure as documented in https://www.postgresql.org/docs/current/sql-update.html

func (*UpdateQuery) AppendHint added in v0.15.0

func (h *UpdateQuery) AppendHint(hint string)

func (*UpdateQuery) AppendModifier added in v0.15.0

func (h *UpdateQuery) AppendModifier(modifier T)

func (UpdateQuery) WriteSQL added in v0.15.0

func (u UpdateQuery) WriteSQL(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error)

type Value added in v0.43.0

type Value []bob.Expression

func (Value) WriteSQL added in v0.43.0

func (v Value) WriteSQL(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error)

type ValuesQuery added in v0.43.0

type ValuesQuery struct {
	// row constructor list
	// each sub-slice is one set of values wrapped in ROW()
	RowVals []Value

	clause.OrderBy
	clause.Limit
}

Trying to represent the query structure as documented in https://dev.mysql.com/doc/refman/8.0/en/values.html

func (*ValuesQuery) AppendValues added in v0.43.0

func (v *ValuesQuery) AppendValues(vals ...bob.Expression)

func (ValuesQuery) WriteSQL added in v0.43.0

func (v ValuesQuery) WriteSQL(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error)

Jump to

Keyboard shortcuts

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