dialect

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2024 License: MIT Imports: 7 Imported by: 6

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 CrossJoin

func CrossJoin[Q Joinable](e any) 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 StraightJoin

func StraightJoin[Q Joinable](e any) bob.Mod[Q]

func Subquery

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

Types

type CTEChain

type CTEChain[Q interface{ AppendWith(clause.CTE) }] func() clause.CTE

func With

func With[Q interface{ AppendWith(clause.CTE) }](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.Table
	clause.From
	clause.Where
	clause.OrderBy
	clause.Limit
	// 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) WriteSQL added in v0.15.0

func (d DeleteQuery) WriteSQL(w io.Writer, 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.From

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 {

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

func NewFunction

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

func (*Function) Apply

func (f *Function) Apply(q *clause.From)

A function can be a target for a query

func (*Function) Filter

func (f *Function) Filter(e ...any) *Function

func (*Function) Over

func (f *Function) Over(window string) *functionOver

func (Function) WriteSQL

func (f Function) WriteSQL(w io.Writer, 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.Values

	Table              any
	Columns            []string
	RowAlias           string
	ColumnAlias        []string
	Sets               []Set
	DuplicateKeyUpdate clause.Set
	// 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) AppendPartition added in v0.15.0

func (h *InsertQuery) AppendPartition(partitions ...string)

func (InsertQuery) WriteSQL added in v0.15.0

func (i InsertQuery) WriteSQL(w io.Writer, d bob.Dialect, start int) ([]any, error)

type JoinChain

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

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 (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{ SetFor(clause.For) }] func() clause.For

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(clause.OrderDef) }] 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(collation string) OrderBy[Q]

func (OrderBy[Q]) Desc

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

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(w io.Writer, 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(w io.Writer, d bob.Dialect, start int) ([]any, error)

type UpdateQuery added in v0.15.0

type UpdateQuery struct {
	clause.With
	clause.Set
	clause.From
	clause.Where
	clause.OrderBy
	clause.Limit
	// 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(w io.Writer, d bob.Dialect, start int) ([]any, error)

type WindowChain

type WindowChain[T any] struct {
	Wrap T
	// contains filtered or unexported fields
}

func (*WindowChain[T]) From

func (w *WindowChain[T]) From(name string) T

func (*WindowChain[T]) FromCurrentRow

func (w *WindowChain[T]) FromCurrentRow() T

func (*WindowChain[T]) FromFollowing

func (w *WindowChain[T]) FromFollowing(exp any) T

func (*WindowChain[T]) FromPreceding

func (w *WindowChain[T]) FromPreceding(exp any) T

func (*WindowChain[T]) FromUnboundedPreceding

func (w *WindowChain[T]) FromUnboundedPreceding() T

func (*WindowChain[T]) OrderBy

func (w *WindowChain[T]) OrderBy(order ...any) T

func (*WindowChain[T]) PartitionBy

func (w *WindowChain[T]) PartitionBy(condition ...any) T

func (*WindowChain[T]) Range

func (w *WindowChain[T]) Range() T

func (*WindowChain[T]) Rows

func (w *WindowChain[T]) Rows() T

func (*WindowChain[T]) ToCurrentRow

func (w *WindowChain[T]) ToCurrentRow(count int) T

func (*WindowChain[T]) ToFollowing

func (w *WindowChain[T]) ToFollowing(exp any) T

func (*WindowChain[T]) ToPreceding

func (w *WindowChain[T]) ToPreceding(exp any) T

func (*WindowChain[T]) ToUnboundedFollowing

func (w *WindowChain[T]) ToUnboundedFollowing() T

type WindowMod

type WindowMod[Q interface{ AppendWindow(clause.NamedWindow) }] struct {
	Name string
	*WindowChain[*WindowMod[Q]]
}

func (WindowMod[Q]) Apply

func (w WindowMod[Q]) Apply(q Q)

Jump to

Keyboard shortcuts

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