mm

package
v0.43.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Columns

func Columns(columns ...string) bob.Mod[*InsertAction]

Columns specifies the target columns for INSERT action Column names can include subfield names or array subscripts if needed

func Into

func Into(name any) bob.Mod[*dialect.MergeQuery]

Into specifies the target table for the MERGE statement

func IntoAs

func IntoAs(name any, alias string) bob.Mod[*dialect.MergeQuery]

IntoAs specifies the target table with an alias for the MERGE statement

func Only

func Only() bob.Mod[*dialect.MergeQuery]

Only specifies ONLY modifier for the target table

func OverridingSystem

func OverridingSystem() bob.Mod[*InsertAction]

OverridingSystem adds OVERRIDING SYSTEM VALUE for INSERT action Use when inserting into identity columns defined as GENERATED ALWAYS

func OverridingUser

func OverridingUser() bob.Mod[*InsertAction]

OverridingUser adds OVERRIDING USER VALUE for INSERT action Use when identity columns defined as GENERATED BY DEFAULT should use sequence values

func Recursive

func Recursive(r bool) bob.Mod[*dialect.MergeQuery]

func Returning

func Returning(clauses ...any) bob.Mod[*dialect.MergeQuery]

Returning adds a RETURNING clause

func Set

func Set(sets ...bob.Expression) bob.Mod[*UpdateAction]

Set adds raw SET expressions to the UPDATE action

func Values

func Values(values ...bob.Expression) bob.Mod[*InsertAction]

Values specifies the values for INSERT action Expressions can reference source data columns (for WHEN NOT MATCHED BY TARGET) Use psql.Quote("source_alias", "column") to reference source columns Use psql.Arg(value) for literal values Use expr.Raw("DEFAULT") for DEFAULT keyword

func With

func With(name string, columns ...string) dialect.CTEChain[*dialect.MergeQuery]

Types

type InsertAction

type InsertAction struct {
	Columns    []string
	Values     []bob.Expression
	Overriding dialect.OverridingType
}

InsertAction is a builder for INSERT action in MERGE Supports: INSERT [(columns...)] [OVERRIDING {SYSTEM|USER} VALUE] {VALUES (...) | DEFAULT VALUES}

type SetChain

type SetChain struct {
	// contains filtered or unexported fields
}

SetChain is a chain for building SET column = value

func SetCol

func SetCol(column string) SetChain

SetCol creates a single column setter: column = expression | DEFAULT

func (SetChain) To

func (s SetChain) To(value any) bob.Mod[*UpdateAction]

To sets column to a raw value: column = value

func (SetChain) ToArg

func (s SetChain) ToArg(value any) bob.Mod[*UpdateAction]

ToArg sets column to a parameterized value: column = $N

func (SetChain) ToDefault

func (s SetChain) ToDefault() bob.Mod[*UpdateAction]

ToDefault sets column to DEFAULT: column = DEFAULT

func (SetChain) ToExpr

func (s SetChain) ToExpr(e bob.Expression) bob.Mod[*UpdateAction]

ToExpr sets column to an expression: column = expression Use psql.Quote("source_alias", "column") to reference source columns Use psql.Quote("target_alias", "column") to reference target columns

type SetColsChain

type SetColsChain struct {
	// contains filtered or unexported fields
}

SetColsChain is a chain for building SET (columns...) = ROW(...) | (subquery)

func SetCols

func SetCols(columns ...string) SetColsChain

SetCols creates a multi-column setter: (columns...) = ROW(...) | (subquery)

func (SetColsChain) ToExprs

func (s SetColsChain) ToExprs(values ...bob.Expression) bob.Mod[*UpdateAction]

ToExprs sets columns to expressions without ROW: (columns...) = (expressions...)

func (SetColsChain) ToQuery

func (s SetColsChain) ToQuery(q bob.Query) bob.Mod[*UpdateAction]

ToQuery sets columns from a subquery: (columns...) = (subquery)

func (SetColsChain) ToRow

func (s SetColsChain) ToRow(values ...bob.Expression) bob.Mod[*UpdateAction]

ToRow sets columns to ROW of expressions: (columns...) = ROW (expressions...)

type UpdateAction

type UpdateAction struct {
	Set []any
}

UpdateAction is a builder for UPDATE action in MERGE

type UsingChain

type UsingChain struct {
	// contains filtered or unexported fields
}

UsingChain is a chain for building the USING clause

func Using

func Using(source any) UsingChain

Using specifies the data source for the MERGE statement. Accepts a table name or a bob.Query (subquery).

func (UsingChain) As

func (u UsingChain) As(alias string) UsingChain

func (UsingChain) On

func (u UsingChain) On(condition bob.Expression) bob.Mod[*dialect.MergeQuery]

func (UsingChain) OnEQ

func (u UsingChain) OnEQ(left, right bob.Expression) bob.Mod[*dialect.MergeQuery]

func (UsingChain) Only

func (u UsingChain) Only() UsingChain

type WhenMatchedChain

type WhenMatchedChain struct {
	// contains filtered or unexported fields
}

WhenMatchedChain is a chain for building WHEN MATCHED and WHEN NOT MATCHED BY SOURCE clauses

func WhenMatched

func WhenMatched() WhenMatchedChain

WhenMatched creates a WHEN MATCHED clause chain

func WhenNotMatchedBySource

func WhenNotMatchedBySource() WhenMatchedChain

WhenNotMatchedBySource creates a WHEN NOT MATCHED BY SOURCE clause chain

func (WhenMatchedChain) And

And adds a condition to the WHEN clause

func (WhenMatchedChain) ThenDelete

func (c WhenMatchedChain) ThenDelete() bob.Mod[*dialect.MergeQuery]

ThenDelete sets the action to DELETE

func (WhenMatchedChain) ThenDoNothing

func (c WhenMatchedChain) ThenDoNothing() bob.Mod[*dialect.MergeQuery]

ThenDoNothing sets the action to DO NOTHING

func (WhenMatchedChain) ThenUpdate

func (c WhenMatchedChain) ThenUpdate(sets ...bob.Mod[*UpdateAction]) bob.Mod[*dialect.MergeQuery]

ThenUpdate sets the action to UPDATE with SET clauses

type WhenNotMatchedChain

type WhenNotMatchedChain struct {
	// contains filtered or unexported fields
}

WhenNotMatchedChain is a chain for building WHEN NOT MATCHED [BY TARGET] clauses

func WhenNotMatched

func WhenNotMatched() WhenNotMatchedChain

WhenNotMatched creates a WHEN NOT MATCHED (BY TARGET) clause chain

func WhenNotMatchedByTarget

func WhenNotMatchedByTarget() WhenNotMatchedChain

WhenNotMatchedByTarget is an alias for WhenNotMatched with explicit BY TARGET

func (WhenNotMatchedChain) And

And adds a condition to the WHEN clause

func (WhenNotMatchedChain) ThenDoNothing

func (c WhenNotMatchedChain) ThenDoNothing() bob.Mod[*dialect.MergeQuery]

ThenDoNothing sets the action to DO NOTHING

func (WhenNotMatchedChain) ThenInsert

func (c WhenNotMatchedChain) ThenInsert(mods ...bob.Mod[*InsertAction]) bob.Mod[*dialect.MergeQuery]

ThenInsert sets the action to INSERT

func (WhenNotMatchedChain) ThenInsertDefaultValues

func (c WhenNotMatchedChain) ThenInsertDefaultValues() bob.Mod[*dialect.MergeQuery]

ThenInsertDefaultValues sets the action to INSERT DEFAULT VALUES

Jump to

Keyboard shortcuts

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