package clause
import "gorm.io/gorm/clause"
Index ¶
- Constants
- Variables
- type AndConditions
- type Assignment
- type Builder
- type Clause
- type ClauseBuilder
- type Column
- type CommaExpression
- type Delete
- func (d Delete) Build(builder Builder)
- func (d Delete) MergeClause(clause *Clause)
- func (d Delete) Name() string
- type Eq
- type Expr
- type Expression
- func And(exprs ...Expression) Expression
- func Not(exprs ...Expression) Expression
- func Or(exprs ...Expression) Expression
- type From
- func (from From) Build(builder Builder)
- func (from From) MergeClause(clause *Clause)
- func (from From) Name() string
- type GroupBy
- func (groupBy GroupBy) Build(builder Builder)
- func (groupBy GroupBy) MergeClause(clause *Clause)
- func (groupBy GroupBy) Name() string
- type Gt
- type Gte
- type IN
- type Insert
- func (insert Insert) Build(builder Builder)
- func (insert Insert) MergeClause(clause *Clause)
- func (insert Insert) Name() string
- type Interface
- type Join
- type JoinType
- type Like
- type Limit
- func (limit Limit) Build(builder Builder)
- func (limit Limit) MergeClause(clause *Clause)
- func (limit Limit) Name() string
- type Locking
- func (locking Locking) Build(builder Builder)
- func (locking Locking) MergeClause(clause *Clause)
- func (locking Locking) Name() string
- type Lt
- type Lte
- type NamedExpr
- type NegationExpressionBuilder
- type Neq
- type NotConditions
- type OnConflict
- func (onConflict OnConflict) Build(builder Builder)
- func (onConflict OnConflict) MergeClause(clause *Clause)
- func (OnConflict) Name() string
- type OrConditions
- type OrderBy
- func (orderBy OrderBy) Build(builder Builder)
- func (orderBy OrderBy) MergeClause(clause *Clause)
- func (orderBy OrderBy) Name() string
- type OrderByColumn
- type Returning
- func (returning Returning) Build(builder Builder)
- func (returning Returning) MergeClause(clause *Clause)
- func (returning Returning) Name() string
- type Select
- func (s Select) Build(builder Builder)
- func (s Select) MergeClause(clause *Clause)
- func (s Select) Name() string
- type Set
- func AssignmentColumns(values []string) Set
- func Assignments(values map[string]interface{}) Set
- func (set Set) Build(builder Builder)
- func (set Set) MergeClause(clause *Clause)
- func (set Set) Name() string
- type Table
- type Update
- func (update Update) Build(builder Builder)
- func (update Update) MergeClause(clause *Clause)
- func (update Update) Name() string
- type Values
- func (values Values) Build(builder Builder)
- func (values Values) MergeClause(clause *Clause)
- func (Values) Name() string
- type Where
- func (where Where) Build(builder Builder)
- func (where Where) MergeClause(clause *Clause)
- func (where Where) Name() string
- type With
- type Writer
Constants ¶
const ( PrimaryKey string = "~~~py~~~" // primary key CurrentTable string = "~~~ct~~~" // current table Associations string = "~~~as~~~" // associations )
const ( LockingStrengthUpdate = "UPDATE" = "SHARE" LockingOptionsSkipLocked = "SKIP LOCKED" LockingOptionsNoWait = "NOWAIT" )
const ( AndWithSpace = " AND " OrWithSpace = " OR " )
Variables ¶
var ( PrimaryColumn = Column{Table: CurrentTable, Name: PrimaryKey} )
Types ¶
type AndConditions ¶
type AndConditions struct { Exprs []Expression }
func (AndConditions) Build ¶
func (and AndConditions) Build(builder Builder)
type Assignment ¶
type Assignment struct { Column Column Value interface{} }
type Builder ¶
type Builder interface { Writer WriteQuoted(field interface{}) AddVar(Writer, ...interface{}) AddError(error) error }
Builder builder interface
type Clause ¶
type Clause struct { Name string // WHERE BeforeExpression Expression AfterNameExpression Expression AfterExpression Expression Expression Expression Builder ClauseBuilder }
Clause
func (Clause) Build ¶
Build build clause
type ClauseBuilder ¶
ClauseBuilder clause builder, allows to customize how to build clause
type Column ¶
Column quote with name
type CommaExpression ¶
type CommaExpression struct { Exprs []Expression }
CommaExpression represents a group of expressions separated by commas.
func (CommaExpression) Build ¶
func (comma CommaExpression) Build(builder Builder)
type Delete ¶
type Delete struct { Modifier string }
func (Delete) Build ¶
func (Delete) MergeClause ¶
func (Delete) Name ¶
type Eq ¶
type Eq struct { Column interface{} Value interface{} }
Eq equal to for where
func (Eq) Build ¶
func (Eq) NegationBuild ¶
type Expr ¶
Expr raw expression
func (Expr) Build ¶
Build build raw expression
type Expression ¶
type Expression interface { Build(builder Builder) }
Expression expression interface
func And ¶
func And(exprs ...Expression) Expression
func Not ¶
func Not(exprs ...Expression) Expression
func Or ¶
func Or(exprs ...Expression) Expression
type From ¶
From from clause
func (From) Build ¶
Build build from clause
func (From) MergeClause ¶
MergeClause merge from clause
func (From) Name ¶
Name from clause name
type GroupBy ¶
type GroupBy struct { Columns []Column Having []Expression }
GroupBy group by clause
func (GroupBy) Build ¶
Build build group by clause
func (GroupBy) MergeClause ¶
MergeClause merge group by clause
func (GroupBy) Name ¶
Name from clause name
type Gt ¶
type Gt Eq
Gt greater than for where
func (Gt) Build ¶
func (Gt) NegationBuild ¶
type Gte ¶
type Gte Eq
Gte greater than or equal to for where
func (Gte) Build ¶
func (Gte) NegationBuild ¶
type IN ¶
type IN struct { Column interface{} Values []interface{} }
IN Whether a value is within a set of values
func (IN) Build ¶
func (IN) NegationBuild ¶
type Insert ¶
func (Insert) Build ¶
Build build insert clause
func (Insert) MergeClause ¶
MergeClause merge insert clause
func (Insert) Name ¶
Name insert clause name
type Interface ¶
Interface clause interface
type Join ¶
type Join struct { Type JoinType Table Table ON Where Using []string Expression Expression }
Join clause for from
func (Join) Build ¶
type JoinType ¶
type JoinType string
const ( CrossJoin JoinType = "CROSS" InnerJoin JoinType = "INNER" LeftJoin JoinType = "LEFT" RightJoin JoinType = "RIGHT" )
type Like ¶
type Like Eq
Like whether string matches regular expression
func (Like) Build ¶
func (Like) NegationBuild ¶
type Limit ¶
Limit limit clause
func (Limit) Build ¶
Build build where clause
func (Limit) MergeClause ¶
MergeClause merge order by clauses
func (Limit) Name ¶
Name where clause name
type Locking ¶
func (Locking) Build ¶
Build build where clause
func (Locking) MergeClause ¶
MergeClause merge order by clauses
func (Locking) Name ¶
Name where clause name
type Lt ¶
type Lt Eq
Lt less than for where
func (Lt) Build ¶
func (Lt) NegationBuild ¶
type Lte ¶
type Lte Eq
Lte less than or equal to for where
func (Lte) Build ¶
func (Lte) NegationBuild ¶
type NamedExpr ¶
type NamedExpr struct { SQL string Vars []interface{} }
NamedExpr raw expression for named expr
func (NamedExpr) Build ¶
Build build raw expression
type NegationExpressionBuilder ¶
type NegationExpressionBuilder interface { NegationBuild(builder Builder) }
NegationExpressionBuilder negation expression builder
type Neq ¶
type Neq Eq
Neq not equal to for where
func (Neq) Build ¶
func (Neq) NegationBuild ¶
type NotConditions ¶
type NotConditions struct { Exprs []Expression }
func (NotConditions) Build ¶
func (not NotConditions) Build(builder Builder)
type OnConflict ¶
type OnConflict struct { Columns []Column Where Where TargetWhere Where OnConstraint string DoNothing bool DoUpdates Set UpdateAll bool }
func (OnConflict) Build ¶
func (onConflict OnConflict) Build(builder Builder)
Build build onConflict clause
func (OnConflict) MergeClause ¶
func (onConflict OnConflict) MergeClause(clause *Clause)
MergeClause merge onConflict clauses
func (OnConflict) Name ¶
func (OnConflict) Name() string
type OrConditions ¶
type OrConditions struct { Exprs []Expression }
func (OrConditions) Build ¶
func (or OrConditions) Build(builder Builder)
type OrderBy ¶
type OrderBy struct { Columns []OrderByColumn Expression Expression }
func (OrderBy) Build ¶
Build build where clause
func (OrderBy) MergeClause ¶
MergeClause merge order by clauses
func (OrderBy) Name ¶
Name where clause name
type OrderByColumn ¶
type Returning ¶
type Returning struct { Columns []Column }
func (Returning) Build ¶
Build build where clause
func (Returning) MergeClause ¶
MergeClause merge order by clauses
func (Returning) Name ¶
Name where clause name
type Select ¶
type Select struct { Distinct bool Columns []Column Expression Expression }
Select select attrs when querying, updating, creating
func (Select) Build ¶
func (Select) MergeClause ¶
func (Select) Name ¶
type Set ¶
type Set []Assignment
func AssignmentColumns ¶
func Assignments ¶
func (Set) Build ¶
func (Set) MergeClause ¶
MergeClause merge assignments clauses
func (Set) Name ¶
type Table ¶
Table quote with name
type Update ¶
func (Update) Build ¶
Build build update clause
func (Update) MergeClause ¶
MergeClause merge update clause
func (Update) Name ¶
Name update clause name
type Values ¶
type Values struct { Columns []Column Values [][]interface{} }
func (Values) Build ¶
Build build from clause
func (Values) MergeClause ¶
MergeClause merge values clauses
func (Values) Name ¶
Name from clause name
type Where ¶
type Where struct { Exprs []Expression }
Where where clause
func (Where) Build ¶
Build build where clause
func (Where) MergeClause ¶
MergeClause merge where clauses
func (Where) Name ¶
Name where clause name
type With ¶
type With struct{}
type Writer ¶
Source Files ¶
clause.go delete.go expression.go from.go group_by.go insert.go joins.go limit.go locking.go on_conflict.go order_by.go returning.go select.go set.go update.go values.go where.go with.go
- Version
- v1.26.1 (latest)
- Published
- May 7, 2025
- Platform
- linux/amd64
- Imports
- 6 packages
- Last checked
- 2 weeks ago –
Tools for package owners.