Documentation ¶
Index ¶
- Constants
- Variables
- type AndConditions
- type Assignment
- type Builder
- type Clause
- type ClauseBuilder
- type Column
- type Delete
- type Eq
- type Expr
- type Expression
- type From
- type GroupBy
- type Gt
- type Gte
- type IN
- type Insert
- type Interface
- type Join
- type JoinType
- type Like
- type Limit
- type Locking
- type Lt
- type Lte
- type NamedExpr
- type NegationExpressionBuilder
- type Neq
- type NotConditions
- type OnConflict
- type OrConditions
- type OrderBy
- type OrderByColumn
- type Returning
- type Select
- type Set
- type Table
- type Update
- type Values
- type Where
- type With
- type Writer
Constants ¶
const ( PrimaryKey string = "@@@py@@@" // primary key CurrentTable string = "@@@ct@@@" // current table Associations string = "@@@as@@@" // associations )
Variables ¶
var (
PrimaryColumn = Column{Table: CurrentTable, Name: PrimaryKey}
)
Functions ¶
This section is empty.
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 Clause ¶
type Clause struct { Name string // WHERE BeforeExpression Expression AfterNameExpression Expression AfterExpression Expression Expression Expression Builder ClauseBuilder }
Clause
type ClauseBuilder ¶
ClauseBuilder clause builder, allows to customize how to build clause
type Eq ¶
type Eq struct { Column interface{} Value interface{} }
Eq equal to for where
func (Eq) NegationBuild ¶
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 GroupBy ¶
type GroupBy struct { Columns []Column Having []Expression }
GroupBy group by clause
func (GroupBy) MergeClause ¶
MergeClause merge group by clause
type IN ¶
type IN struct { Column interface{} Values []interface{} }
IN Whether a value is within a set of values
func (IN) NegationBuild ¶
type Insert ¶
func (Insert) MergeClause ¶
MergeClause merge insert clause
type Join ¶
type Join struct { Type JoinType Table Table ON Where Using []string Expression Expression }
Join join clause for from
type Locking ¶
func (Locking) MergeClause ¶ added in v0.2.4
MergeClause merge order by clauses
type NamedExpr ¶ added in v0.2.21
type NamedExpr struct { SQL string Vars []interface{} }
NamedExpr raw expression for named expr
type NegationExpressionBuilder ¶
type NegationExpressionBuilder interface {
NegationBuild(builder Builder)
}
NegationExpressionBuilder negation expression builder
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 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) MergeClause ¶
MergeClause merge order by clauses
type OrderByColumn ¶
type Returning ¶
type Returning struct {
Columns []Column
}
func (Returning) MergeClause ¶
MergeClause merge order by clauses
type Select ¶
type Select struct { Distinct bool Columns []Column Expression Expression }
Select select attrs when querying, updating, creating
func (Select) MergeClause ¶
type Set ¶
type Set []Assignment
func AssignmentColumns ¶ added in v0.2.5
func Assignments ¶ added in v0.2.4
func (Set) MergeClause ¶
MergeClause merge assignments clauses
type Update ¶
func (Update) MergeClause ¶
MergeClause merge update clause
type Values ¶
type Values struct { Columns []Column Values [][]interface{} }
func (Values) MergeClause ¶
MergeClause merge values clauses
type Where ¶
type Where struct {
Exprs []Expression
}
Where where clause
func (Where) MergeClause ¶
MergeClause merge where clauses