const ( UnionCompoundType CompoundType = iota UnionAllCompoundType IntersectCompoundType IntersectAllCompoundType DoNothingConflictAction ConflictAction = iota DoUpdateConflictAction AndType ExpressionListType = iota OrType InnerJoinType JoinType = iota FullOuterJoinType RightOuterJoinType LeftOuterJoinType FullJoinType RightJoinType LeftJoinType NaturalJoinType NaturalLeftJoinType NaturalRightJoinType NaturalFullJoinType CrossJoinType UsingJoinCondType JoinConditionType = iota OnJoinCondType // Default null sort type with no null sort order NoNullsSortType NullSortType = iota // NULLS FIRST NullsFirstSortType // NULLS LAST NullsLastSortType // ASC AscDir SortDirection = iota // DESC DescSortDir // BETWEEN BetweenOp RangeOperation = iota // NOT BETWEEN NotBetweenOp // = EqOp BooleanOperation = iota // != or <> NeqOp // IS IsOp // IS NOT IsNotOp // > GtOp // >= GteOp // < LtOp // <= LteOp // IN InOp // NOT IN NotInOp // LIKE, LIKE BINARY... LikeOp // NOT LIKE, NOT LIKE BINARY... NotLikeOp // ILIKE, LIKE ILikeOp // NOT ILIKE, NOT LIKE NotILikeOp // ~, REGEXP BINARY RegexpLikeOp // !~, NOT REGEXP BINARY RegexpNotLikeOp // ~*, REGEXP RegexpILikeOp // !~*, NOT REGEXP RegexpNotILikeOp BitwiseInversionOp BitwiseOperation = iota BitwiseOrOp BitwiseAndOp BitwiseXorOp BitwiseLeftShiftOp BitwiseRightShiftOp )
const ( ForNolock LockStrength = iota ForUpdate ForNoKeyUpdate Wait WaitOption = iota NoWait SkipLocked )
var ( ConditionedJoinTypes = map[JoinType]bool{ InnerJoinType: true, FullOuterJoinType: true, RightOuterJoinType: true, LeftOuterJoinType: true, FullJoinType: true, RightJoinType: true, LeftJoinType: true, } )
Interface that an expression should implement if it can be aliased.
type Aliaseable interface { // Returns an AliasedExpression // I("col").As("other_col") //"col" AS "other_col" // I("col").As(I("other_col")) //"col" AS "other_col" As(interface{}) AliasedExpression }
Expression for Aliased expressions
I("a").As("b") -> "a" AS "b" SUM("a").As(I("a_sum")) -> SUM("a") AS "a_sum"
type AliasedExpression interface { Expression // Returns the Epxression being aliased Aliased() Expression // Returns the alias value as an identiier expression GetAs() IdentifierExpression // Returns a new IdentifierExpression with the specified schema Schema(string) IdentifierExpression // Returns a new IdentifierExpression with the specified table Table(string) IdentifierExpression // Returns a new IdentifierExpression with the specified column Col(interface{}) IdentifierExpression // Returns a new IdentifierExpression with the column set to * // I("my_table").All() //"my_table".* All() IdentifierExpression }
func NewAliasExpression(exp Expression, alias interface{}) AliasedExpression
Creates a new AliasedExpression for the Expression and alias
type AppendableExpression interface { Expression AppendSQL(b sb.SQLBuilder) // Returns the alias value as an identiier expression GetAs() IdentifierExpression // Returns true if this expression returns columns. // Used to determine if a Select, Update, Insert, or Delete query returns columns ReturnsColumns() bool }
type BitwiseExpression interface { Expression Aliaseable Comparable Isable Inable Likeable Rangeable Orderable Distinctable // Returns the operator for the expression Op() BitwiseOperation // The left hand side of the expression (e.g. I("a") LHS() Expression // The right hand side of the expression could be a primitive value, dataset, or expression RHS() interface{} }
func NewBitwiseExpression(op BitwiseOperation, lhs Expression, rhs interface{}) BitwiseExpression
type BitwiseOperation int
func (bi BitwiseOperation) String() string
Behaviors
type Bitwiseable interface { // Creates a Bit Operation Expresion for sql ~ // I("col").BitiInversion() // (~ "col") BitwiseInversion() BitwiseExpression // Creates a Bit Operation Expresion for sql | // I("col").BitOr(1) // ("col" | 1) BitwiseOr(interface{}) BitwiseExpression // Creates a Bit Operation Expresion for sql & // I("col").BitAnd(1) // ("col" & 1) BitwiseAnd(interface{}) BitwiseExpression // Creates a Bit Operation Expresion for sql ^ // I("col").BitXor(1) // ("col" ^ 1) BitwiseXor(interface{}) BitwiseExpression // Creates a Bit Operation Expresion for sql << // I("col").BitLeftShift(1) // ("col" << 1) BitwiseLeftShift(interface{}) BitwiseExpression // Creates a Bit Operation Expresion for sql >> // I("col").BitRighttShift(1) // ("col" >> 1) BitwiseRightShift(interface{}) BitwiseExpression }
type BooleanExpression interface { Expression Aliaseable // Returns the operator for the expression Op() BooleanOperation // The left hand side of the expression (e.g. I("a") LHS() Expression // The right hand side of the expression could be a primitive value, dataset, or expression RHS() interface{} }
func NewBooleanExpression(op BooleanOperation, lhs Expression, rhs interface{}) BooleanExpression
type BooleanOperation int
func (bo BooleanOperation) String() string
type CaseElse interface { Result() interface{} }
func NewCaseElse(result interface{}) CaseElse
type CaseExpression interface { Expression Aliaseable Orderable GetValue() interface{} GetWhens() []CaseWhen GetElse() CaseElse Value(val interface{}) CaseExpression When(condition, result interface{}) CaseExpression Else(result interface{}) CaseExpression }
func NewCaseExpression() CaseExpression
type CaseWhen interface { Condition() interface{} Result() interface{} }
func NewCaseWhen(condition, result interface{}) CaseWhen
An Expression that represents another Expression casted to a SQL type
type CastExpression interface { Expression Aliaseable Comparable Inable Isable Likeable Orderable Distinctable Rangeable // The exression being casted Casted() Expression // The the SQL type to cast the expression to Type() LiteralExpression }
func NewCastExpression(e Expression, t string) CastExpression
Creates a new Casted expression
Cast(I("a"), "NUMERIC") -> CAST("a" AS NUMERIC)
Interface that an expression should implement if it can be casted to another SQL type .
type Castable interface { // Casts an expression to the specified type // I("a").Cast("numeric")//CAST("a" AS numeric) Cast(val string) CastExpression }
A list of columns. Typically used internally by Select, Order, From
type ColumnListExpression interface { Expression // Returns the list of columns Columns() []Expression // Returns true if the column list is empty IsEmpty() bool // Returns a new ColumnListExpression with the columns appended. Append(...Expression) ColumnListExpression }
func NewColumnListExpression(vals ...interface{}) ColumnListExpression
func NewOrderedColumnList(vals ...OrderedExpression) ColumnListExpression
type CommonTableExpression interface { Expression IsRecursive() bool // Returns the alias name for the extracted expression Name() LiteralExpression // Returns the Expression being extracted SubQuery() Expression }
func NewCommonTableExpression(recursive bool, name string, subQuery Expression) CommonTableExpression
Creates a new WITH common table expression for a SQLExpression, typically Datasets'. This function is used internally by Dataset when a CTE is added to another Dataset
Interface that an expression should implement if it can be compared with other values.
type Comparable interface { // Creates a Boolean expression comparing equality // I("col").Eq(1) //("col" = 1) Eq(interface{}) BooleanExpression // Creates a Boolean expression comparing in-equality // I("col").Neq(1) //("col" != 1) Neq(interface{}) BooleanExpression // Creates a Boolean expression for greater than comparisons // I("col").Gt(1) //("col" > 1) Gt(interface{}) BooleanExpression // Creates a Boolean expression for greater than or equal to than comparisons // I("col").Gte(1) //("col" >= 1) Gte(interface{}) BooleanExpression // Creates a Boolean expression for less than comparisons // I("col").Lt(1) //("col" < 1) Lt(interface{}) BooleanExpression // Creates a Boolean expression for less than or equal to comparisons // I("col").Lte(1) //("col" <= 1) Lte(interface{}) BooleanExpression }
type CompoundExpression interface { Expression Type() CompoundType RHS() AppendableExpression }
func NewCompoundExpression(ct CompoundType, rhs AppendableExpression) CompoundExpression
type CompoundType int
Parent type for join expressions
type ConditionedJoinExpression interface { JoinExpression Condition() JoinCondition IsConditionEmpty() bool }
func NewConditionedJoinExpression(joinType JoinType, table Expression, condition JoinCondition) ConditionedJoinExpression
An Expression that the ON CONFLICT/ON DUPLICATE KEY portion of an INSERT statement
type ConflictAction int
type ConflictExpression interface { Expression Action() ConflictAction }
func NewDoNothingConflictExpression() ConflictExpression
Creates a conflict struct to be passed to InsertConflict to ignore constraint errors
InsertConflict(DoNothing(),...) -> INSERT INTO ... ON CONFLICT DO NOTHING
type ConflictUpdateExpression interface { ConflictExpression TargetColumn() string Where(expressions ...Expression) ConflictUpdateExpression WhereClause() ExpressionList Update() interface{} }
func NewDoUpdateConflictExpression(target string, update interface{}) ConflictUpdateExpression
Creates a ConflictUpdate struct to be passed to InsertConflict Represents a ON CONFLICT DO UPDATE portion of an INSERT statement (ON DUPLICATE KEY UPDATE for mysql)
InsertConflict(DoUpdate("target_column", update),...) -> INSERT INTO ... ON CONFLICT DO UPDATE SET a=b InsertConflict(DoUpdate("target_column", update).Where(Ex{"a": 1},...) -> INSERT INTO ... ON CONFLICT DO UPDATE SET a=b WHERE a=1
type DeleteClauses interface { HasFrom() bool CommonTables() []CommonTableExpression CommonTablesAppend(cte CommonTableExpression) DeleteClauses From() IdentifierExpression SetFrom(table IdentifierExpression) DeleteClauses Where() ExpressionList ClearWhere() DeleteClauses WhereAppend(expressions ...Expression) DeleteClauses Order() ColumnListExpression HasOrder() bool ClearOrder() DeleteClauses SetOrder(oes ...OrderedExpression) DeleteClauses OrderAppend(...OrderedExpression) DeleteClauses OrderPrepend(...OrderedExpression) DeleteClauses Limit() interface{} HasLimit() bool ClearLimit() DeleteClauses SetLimit(limit interface{}) DeleteClauses Returning() ColumnListExpression HasReturning() bool SetReturning(cl ColumnListExpression) DeleteClauses // contains filtered or unexported methods }
func NewDeleteClauses() DeleteClauses
Interface that an expression should implement if it can be used in a DISTINCT epxression.
type Distinctable interface { // Creates a DISTINCT clause // I("a").Distinct() //DISTINCT("a") Distinct() SQLFunctionExpression }
A map of expressions to be ANDed together where the keys are string that will be used as Identifiers and values will be used in a boolean operation. The Ex map can be used in tandem with Op map to create more complex expression such as LIKE, GT, LT... See examples.
type Ex map[string]interface{}
func (e Ex) Clone() Expression
func (e Ex) Expression() Expression
func (e Ex) IsEmpty() bool
func (e Ex) ToExpressions() (ExpressionList, error)
A map of expressions to be ORed together where the keys are string that will be used as Identifiers and values will be used in a boolean operation. The Ex map can be used in tandem with Op map to create more complex expression such as LIKE, GT, LT... See examples.
type ExOr map[string]interface{}
func (eo ExOr) Clone() Expression
func (eo ExOr) Expression() Expression
func (eo ExOr) IsEmpty() bool
func (eo ExOr) ToExpressions() (ExpressionList, error)
Parent of all expression types
type Expression interface { Clone() Expression Expression() Expression }
A list of expressions that should be joined together
And(I("a").Eq(10), I("b").Eq(11)) //(("a" = 10) AND ("b" = 11)) Or(I("a").Eq(10), I("b").Eq(11)) //(("a" = 10) OR ("b" = 11))
type ExpressionList interface { Expression // Returns type (e.g. OR, AND) Type() ExpressionListType // Slice of expressions that should be joined together Expressions() []Expression // Returns a new expression list with the given expressions appended to the current Expressions list Append(...Expression) ExpressionList IsEmpty() bool }
func NewExpressionList(operator ExpressionListType, expressions ...Expression) ExpressionList
A list of expressions that should be ORed together
Or(I("a").Eq(10), I("b").Eq(11)) //(("a" = 10) OR ("b" = 11))
type ExpressionListType int
An Identifier that can contain schema, table and column identifiers
type IdentifierExpression interface { Expression Aliaseable Comparable Inable Isable Likeable Rangeable Orderable Updateable Distinctable Castable Bitwiseable // returns true if this identifier has more more than on part (Schema, Table or Col) // "schema" -> true //cant qualify anymore // "schema.table" -> true // "table" -> false // "schema"."table"."col" -> true // "table"."col" -> true // "col" -> false IsQualified() bool // Returns a new IdentifierExpression with the specified schema Schema(string) IdentifierExpression // Returns the current schema GetSchema() string // Returns a new IdentifierExpression with the specified table Table(string) IdentifierExpression // Returns the current table GetTable() string // Returns a new IdentifierExpression with the specified column Col(interface{}) IdentifierExpression // Returns the current column GetCol() interface{} // Returns a new IdentifierExpression with the column set to * // I("my_table").All() //"my_table".* All() IdentifierExpression // Returns true if schema table and identifier are all zero values. IsEmpty() bool }
func NewIdentifierExpression(schema, table string, col interface{}) IdentifierExpression
func ParseIdentifier(ident string) IdentifierExpression
Behaviors
type Inable interface { // Creates a Boolean expression for IN clauses // I("col").In([]string{"a", "b", "c"}) //("col" IN ('a', 'b', 'c')) In(...interface{}) BooleanExpression // Creates a Boolean expression for NOT IN clauses // I("col").NotIn([]string{"a", "b", "c"}) //("col" NOT IN ('a', 'b', 'c')) NotIn(...interface{}) BooleanExpression }
type InsertClauses interface { CommonTables() []CommonTableExpression CommonTablesAppend(cte CommonTableExpression) InsertClauses HasInto() bool Cols() ColumnListExpression HasCols() bool ColsAppend(cols ColumnListExpression) InsertClauses SetCols(cols ColumnListExpression) InsertClauses Into() Expression SetInto(cl Expression) InsertClauses Returning() ColumnListExpression HasReturning() bool SetReturning(cl ColumnListExpression) InsertClauses From() AppendableExpression HasFrom() bool SetFrom(ae AppendableExpression) InsertClauses Rows() []interface{} HasRows() bool SetRows(rows []interface{}) InsertClauses HasAlias() bool Alias() IdentifierExpression SetAlias(ie IdentifierExpression) InsertClauses Vals() [][]interface{} HasVals() bool SetVals(vals [][]interface{}) InsertClauses ValsAppend(vals [][]interface{}) InsertClauses OnConflict() ConflictExpression SetOnConflict(expression ConflictExpression) InsertClauses // contains filtered or unexported methods }
func NewInsertClauses() InsertClauses
type InsertExpression interface { Expression IsEmpty() bool IsInsertFrom() bool From() AppendableExpression Cols() ColumnListExpression SetCols(cols ColumnListExpression) InsertExpression Vals() [][]interface{} SetVals([][]interface{}) InsertExpression }
func NewInsertExpression(rows ...interface{}) (insertExpression InsertExpression, err error)
Behaviors
type Isable interface { // Creates an Boolean expression IS clauses // ds.Where(I("a").Is(nil)) //("a" IS NULL) // ds.Where(I("a").Is(true)) //("a" IS TRUE) // ds.Where(I("a").Is(false)) //("a" IS FALSE) Is(interface{}) BooleanExpression // Creates an Boolean expression IS NOT clauses // ds.Where(I("a").IsNot(nil)) //("a" IS NOT NULL) // ds.Where(I("a").IsNot(true)) //("a" IS NOT TRUE) // ds.Where(I("a").IsNot(false)) //("a" IS NOT FALSE) IsNot(interface{}) BooleanExpression // Shortcut for Is(nil) IsNull() BooleanExpression // Shortcut for IsNot(nil) IsNotNull() BooleanExpression // Shortcut for Is(true) IsTrue() BooleanExpression // Shortcut for IsNot(true) IsNotTrue() BooleanExpression // Shortcut for Is(false) IsFalse() BooleanExpression // Shortcut for IsNot(false) IsNotFalse() BooleanExpression }
type JoinCondition interface { Type() JoinConditionType IsEmpty() bool }
func NewJoinOnCondition(expressions ...Expression) JoinCondition
Creates a new ON clause to be used within a join
ds.Join(I("my_table"), On(I("my_table.fkey").Eq(I("other_table.id")))
func NewJoinUsingCondition(expressions ...interface{}) JoinCondition
Creates a new USING clause to be used within a join
type JoinConditionType int
type JoinExpression interface { Expression JoinType() JoinType IsConditioned() bool Table() Expression }
func NewUnConditionedJoinExpression(joinType JoinType, table Expression) JoinExpression
type JoinExpressions []JoinExpression
func (jes JoinExpressions) Clone() JoinExpressions
type JoinOnCondition interface { JoinCondition On() ExpressionList }
type JoinType int
func (jt JoinType) String() string
type JoinUsingCondition interface { JoinCondition Using() ColumnListExpression }
type LateralExpression interface { Expression Aliaseable Table() AppendableExpression }
func NewLateralExpression(table AppendableExpression) LateralExpression
Creates a new SQL lateral expression
L(From("test")) -> LATERAL (SELECT * FROM "tests")
Behaviors
type Likeable interface { // Creates an Boolean expression for LIKE clauses // ds.Where(I("a").Like("a%")) //("a" LIKE 'a%') Like(interface{}) BooleanExpression // Creates an Boolean expression for NOT LIKE clauses // ds.Where(I("a").NotLike("a%")) //("a" NOT LIKE 'a%') NotLike(interface{}) BooleanExpression // Creates an Boolean expression for case insensitive LIKE clauses // ds.Where(I("a").ILike("a%")) //("a" ILIKE 'a%') ILike(interface{}) BooleanExpression // Creates an Boolean expression for case insensitive NOT LIKE clauses // ds.Where(I("a").NotILike("a%")) //("a" NOT ILIKE 'a%') NotILike(interface{}) BooleanExpression // Creates an Boolean expression for REGEXP LIKE clauses // ds.Where(I("a").RegexpLike("a%")) //("a" ~ 'a%') RegexpLike(interface{}) BooleanExpression // Creates an Boolean expression for REGEXP NOT LIKE clauses // ds.Where(I("a").RegexpNotLike("a%")) //("a" !~ 'a%') RegexpNotLike(interface{}) BooleanExpression // Creates an Boolean expression for case insensitive REGEXP ILIKE clauses // ds.Where(I("a").RegexpILike("a%")) //("a" ~* 'a%') RegexpILike(interface{}) BooleanExpression // Creates an Boolean expression for case insensitive REGEXP NOT ILIKE clauses // ds.Where(I("a").RegexpNotILike("a%")) //("a" !~* 'a%') RegexpNotILike(interface{}) BooleanExpression }
Expression for representing "literal" sql.
L("col = 1") -> col = 1) L("? = ?", I("col"), 1) -> "col" = 1
type LiteralExpression interface { Expression Aliaseable Comparable Isable Inable Likeable Rangeable Orderable Bitwiseable // Returns the literal sql Literal() string // Arguments to be replaced within the sql Args() []interface{} }
func Default() LiteralExpression
Returns a literal for the 'DEFAULT'
func NewLiteralExpression(sql string, args ...interface{}) LiteralExpression
Creates a new SQL literal with the provided arguments.
L("a = 1") -> a = 1
You can also you placeholders. All placeholders within a Literal are represented by '?'
L("a = ?", "b") -> a = 'b'
Literals can also contain placeholders for other expressions
L("(? AND ?) OR (?)", I("a").Eq(1), I("b").Eq("b"), I("c").In([]string{"a", "b", "c"}))
func Star() LiteralExpression
Returns a literal for the '*' operator
type Lock interface { Strength() LockStrength WaitOption() WaitOption Of() []IdentifierExpression }
func NewLock(strength LockStrength, option WaitOption, of ...IdentifierExpression) Lock
type LockStrength int
type NullSortType int
Used in tandem with the Ex map to create complex comparisons such as LIKE, GT, LT... See examples
type Op map[string]interface{}
Interface that an expression should implement if it can be ORDERED.
type Orderable interface { // Creates an Ordered Expression for sql ASC order // ds.Order(I("a").Asc()) //ORDER BY "a" ASC Asc() OrderedExpression // Creates an Ordered Expression for sql DESC order // ds.Order(I("a").Desc()) //ORDER BY "a" DESC Desc() OrderedExpression }
An expression for specifying sort order and options
type OrderedExpression interface { Expression // The expression being sorted SortExpression() Expression // Sort direction (e.g. ASC, DESC) IsAsc() bool // If the adapter supports it null sort type (e.g. NULLS FIRST, NULLS LAST) NullSortType() NullSortType // Returns a new OrderedExpression with NullSortType set to NULLS_FIRST NullsFirst() OrderedExpression // Returns a new OrderedExpression with NullSortType set to NULLS_LAST NullsLast() OrderedExpression }
func NewOrderedExpression(exp Expression, direction SortDirection, sortType NullSortType) OrderedExpression
used internally to create a new SORT_ASC OrderedExpression
type RangeExpression interface { Expression // Returns the operator for the expression Op() RangeOperation // The left hand side of the expression (e.g. I("a") LHS() Expression // The right hand side of the expression could be a primitive value, dataset, or expression RHS() RangeVal }
func NewRangeExpression(op RangeOperation, lhs Expression, rhs RangeVal) RangeExpression
type RangeOperation int
func (ro RangeOperation) String() string
type RangeVal interface { Start() interface{} End() interface{} }
func NewRangeVal(start, end interface{}) RangeVal
Creates a new Range to be used with a Between expression
exp.C("col").Between(exp.Range(1, 10))
Behaviors
type Rangeable interface { // Creates a Range expression for between comparisons // I("col").Between(RangeVal{Start:1, End:10}) //("col" BETWEEN 1 AND 10) Between(RangeVal) RangeExpression // Creates a Range expression for between comparisons // I("col").NotBetween(RangeVal{Start:1, End:10}) //("col" NOT BETWEEN 1 AND 10) NotBetween(RangeVal) RangeExpression }
Alternative to writing map[string]interface{}. Can be used for Inserts, Updates or Deletes
type Record map[string]interface{}
func NewRecordFromStruct(i interface{}, forInsert, forUpdate bool) (r Record, err error)
func (r Record) Cols() []string
An Expression that generates its own sql (e.g Dataset)
type SQLExpression interface { Expression ToSQL() (string, []interface{}, error) IsPrepared() bool }
Expression for representing a SQLFunction(e.g. COUNT, SUM, MIN, MAX...)
type SQLFunctionExpression interface { Expression Aliaseable Rangeable Comparable Orderable Isable Inable Likeable Windowable // The function name Name() string // Arguments to be passed to the function Args() []interface{} }
func NewSQLFunctionExpression(name string, args ...interface{}) SQLFunctionExpression
Creates a new SQLFunctionExpression with the given name and arguments
type SQLWindowFunctionExpression interface { Expression Aliaseable Rangeable Comparable Orderable Isable Inable Likeable Func() SQLFunctionExpression Window() WindowExpression WindowName() IdentifierExpression HasWindow() bool HasWindowName() bool }
func NewSQLWindowFunctionExpression( fn SQLFunctionExpression, windowName IdentifierExpression, window WindowExpression) SQLWindowFunctionExpression
type SelectClauses interface { HasSources() bool IsDefaultSelect() bool Select() ColumnListExpression SelectAppend(cl ColumnListExpression) SelectClauses SetSelect(cl ColumnListExpression) SelectClauses Distinct() ColumnListExpression SetDistinct(cle ColumnListExpression) SelectClauses From() ColumnListExpression SetFrom(cl ColumnListExpression) SelectClauses HasAlias() bool Alias() IdentifierExpression SetAlias(ie IdentifierExpression) SelectClauses Joins() JoinExpressions JoinsAppend(jc JoinExpression) SelectClauses Where() ExpressionList ClearWhere() SelectClauses WhereAppend(expressions ...Expression) SelectClauses Having() ExpressionList ClearHaving() SelectClauses HavingAppend(expressions ...Expression) SelectClauses Order() ColumnListExpression HasOrder() bool ClearOrder() SelectClauses SetOrder(oes ...OrderedExpression) SelectClauses OrderAppend(...OrderedExpression) SelectClauses OrderPrepend(...OrderedExpression) SelectClauses GroupBy() ColumnListExpression SetGroupBy(cl ColumnListExpression) SelectClauses GroupByAppend(cl ColumnListExpression) SelectClauses Limit() interface{} HasLimit() bool ClearLimit() SelectClauses SetLimit(limit interface{}) SelectClauses Offset() uint ClearOffset() SelectClauses SetOffset(offset uint) SelectClauses Compounds() []CompoundExpression CompoundsAppend(ce CompoundExpression) SelectClauses Lock() Lock SetLock(l Lock) SelectClauses CommonTables() []CommonTableExpression CommonTablesAppend(cte CommonTableExpression) SelectClauses Windows() []WindowExpression SetWindows(ws []WindowExpression) SelectClauses WindowsAppend(ws ...WindowExpression) SelectClauses ClearWindows() SelectClauses // contains filtered or unexported methods }
func NewSelectClauses() SelectClauses
type SortDirection int
type TruncateClauses interface { HasTable() bool Table() ColumnListExpression SetTable(tables ColumnListExpression) TruncateClauses Options() TruncateOptions SetOptions(opts TruncateOptions) TruncateClauses // contains filtered or unexported methods }
func NewTruncateClauses() TruncateClauses
Options to use when generating a TRUNCATE statement
type TruncateOptions struct { // Set to true to add CASCADE to the TRUNCATE statement Cascade bool // Set to true to add RESTRICT to the TRUNCATE statement Restrict bool // Set to true to specify IDENTITY options, (e.g. RESTART, CONTINUE) to the TRUNCATE statement Identity string }
type UpdateClauses interface { HasTable() bool CommonTables() []CommonTableExpression CommonTablesAppend(cte CommonTableExpression) UpdateClauses Table() Expression SetTable(table Expression) UpdateClauses SetValues() interface{} HasSetValues() bool SetSetValues(values interface{}) UpdateClauses From() ColumnListExpression HasFrom() bool SetFrom(tables ColumnListExpression) UpdateClauses Where() ExpressionList ClearWhere() UpdateClauses WhereAppend(expressions ...Expression) UpdateClauses Order() ColumnListExpression HasOrder() bool ClearOrder() UpdateClauses SetOrder(oes ...OrderedExpression) UpdateClauses OrderAppend(...OrderedExpression) UpdateClauses OrderPrepend(...OrderedExpression) UpdateClauses Limit() interface{} HasLimit() bool ClearLimit() UpdateClauses SetLimit(limit interface{}) UpdateClauses Returning() ColumnListExpression HasReturning() bool SetReturning(cl ColumnListExpression) UpdateClauses // contains filtered or unexported methods }
func NewUpdateClauses() UpdateClauses
type UpdateExpression interface { Col() IdentifierExpression Val() interface{} }
func NewUpdateExpressions(update interface{}) (updates []UpdateExpression, err error)
Behaviors
type Updateable interface { // Used internally by update sql Set(interface{}) UpdateExpression }
type Vals []interface{}
type WaitOption int
type WindowExpression interface { Expression Name() IdentifierExpression HasName() bool Parent() IdentifierExpression HasParent() bool PartitionCols() ColumnListExpression HasPartitionBy() bool OrderCols() ColumnListExpression HasOrder() bool Inherit(parent string) WindowExpression PartitionBy(cols ...interface{}) WindowExpression OrderBy(cols ...interface{}) WindowExpression }
func NewWindowExpression(window, parent IdentifierExpression, partitionCols, orderCols ColumnListExpression) WindowExpression
type Windowable interface { Over(WindowExpression) SQLWindowFunctionExpression OverName(IdentifierExpression) SQLWindowFunctionExpression }