goqu: github.com/doug-martin/goqu/exp Index | Files

package exp

import "github.com/doug-martin/goqu/exp"

Index

Package Files

alias.go bool.go cast.go col.go compound.go conflict.go cte.go delete_clauses.go exp.go exp_list.go exp_map.go func.go ident.go insert.go insert_clauses.go join.go lateral.go literal.go lock.go order.go range.go record.go select_clauses.go truncate.go truncate_clauses.go update.go update_clauses.go window.go window_func.go

Constants

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

    // 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
)
const (
    ForNolock LockStrength = iota
    ForUpdate
    ForNoKeyUpdate
    ForShare
    ForKeyShare

    Wait WaitOption = iota
    NoWait
    SkipLocked
)

Variables

var (
    ConditionedJoinTypes = map[JoinType]bool{
        InnerJoinType:      true,
        FullOuterJoinType:  true,
        RightOuterJoinType: true,
        LeftOuterJoinType:  true,
        FullJoinType:       true,
        RightJoinType:      true,
        LeftJoinType:       true,
    }
)

type Aliaseable Uses

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
}

Interface that an expression should implement if it can be aliased.

type AliasedExpression Uses

type AliasedExpression interface {
    Expression
    // Returns the Epxression being aliased
    Aliased() Expression
    // Returns the alias value as an identiier expression
    GetAs() IdentifierExpression
}

Expression for Aliased expressions

I("a").As("b") -> "a" AS "b"
SUM("a").As(I("a_sum")) -> SUM("a") AS "a_sum"

type AppendableExpression Uses

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 BooleanExpression Uses

type BooleanExpression interface {
    Expression
    // 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 Uses

func NewBooleanExpression(op BooleanOperation, lhs Expression, rhs interface{}) BooleanExpression

type BooleanOperation Uses

type BooleanOperation int

func (BooleanOperation) String Uses

func (bo BooleanOperation) String() string

type CastExpression Uses

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
}

An Expression that represents another Expression casted to a SQL type

func NewCastExpression Uses

func NewCastExpression(e Expression, t string) CastExpression

Creates a new Casted expression

Cast(I("a"), "NUMERIC") -> CAST("a" AS NUMERIC)

type Castable Uses

type Castable interface {
    // Casts an expression to the specified type
    //   I("a").Cast("numeric")//CAST("a" AS numeric)
    Cast(val string) CastExpression
}

Interface that an expression should implement if it can be casted to another SQL type .

type ColumnListExpression Uses

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
}

A list of columns. Typically used internally by Select, Order, From

func NewColumnListExpression Uses

func NewColumnListExpression(vals ...interface{}) ColumnListExpression

func NewOrderedColumnList Uses

func NewOrderedColumnList(vals ...OrderedExpression) ColumnListExpression

type CommonTableExpression Uses

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 Uses

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

type Comparable Uses

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
}

Interface that an expression should implement if it can be compared with other values.

type CompoundExpression Uses

type CompoundExpression interface {
    Expression
    Type() CompoundType
    RHS() AppendableExpression
}

func NewCompoundExpression Uses

func NewCompoundExpression(ct CompoundType, rhs AppendableExpression) CompoundExpression

type CompoundType Uses

type CompoundType int

type ConditionedJoinExpression Uses

type ConditionedJoinExpression interface {
    JoinExpression
    Condition() JoinCondition
    IsConditionEmpty() bool
}

Parent type for join expressions

func NewConditionedJoinExpression Uses

func NewConditionedJoinExpression(joinType JoinType, table Expression, condition JoinCondition) ConditionedJoinExpression

type ConflictAction Uses

type ConflictAction int

An Expression that the ON CONFLICT/ON DUPLICATE KEY portion of an INSERT statement

type ConflictExpression Uses

type ConflictExpression interface {
    Expression
    Action() ConflictAction
}

func NewDoNothingConflictExpression Uses

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 Uses

type ConflictUpdateExpression interface {
    ConflictExpression
    TargetColumn() string
    Where(expressions ...Expression) ConflictUpdateExpression
    WhereClause() ExpressionList
    Update() interface{}
}

func NewDoUpdateConflictExpression Uses

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 Uses

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 Uses

func NewDeleteClauses() DeleteClauses

type Distinctable Uses

type Distinctable interface {
    // Creates a DISTINCT clause
    //   I("a").Distinct() //DISTINCT("a")
    Distinct() SQLFunctionExpression
}

Interface that an expression should implement if it can be used in a DISTINCT epxression.

type Ex Uses

type Ex map[string]interface{}

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.

func (Ex) Clone Uses

func (e Ex) Clone() Expression

func (Ex) Expression Uses

func (e Ex) Expression() Expression

func (Ex) IsEmpty Uses

func (e Ex) IsEmpty() bool

func (Ex) ToExpressions Uses

func (e Ex) ToExpressions() (ExpressionList, error)

type ExOr Uses

type ExOr map[string]interface{}

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.

func (ExOr) Clone Uses

func (eo ExOr) Clone() Expression

func (ExOr) Expression Uses

func (eo ExOr) Expression() Expression

func (ExOr) IsEmpty Uses

func (eo ExOr) IsEmpty() bool

func (ExOr) ToExpressions Uses

func (eo ExOr) ToExpressions() (ExpressionList, error)

type Expression Uses

type Expression interface {
    Clone() Expression
    Expression() Expression
}

Parent of all expression types

type ExpressionList Uses

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
}

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))

func NewExpressionList Uses

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 Uses

type ExpressionListType int

type IdentifierExpression Uses

type IdentifierExpression interface {
    Expression
    Aliaseable
    Comparable
    Inable
    Isable
    Likeable
    Rangeable
    Orderable
    Updateable
    Distinctable
    Castable
    // 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
}

An Identifier that can contain schema, table and column identifiers

func NewIdentifierExpression Uses

func NewIdentifierExpression(schema, table string, col interface{}) IdentifierExpression

func ParseIdentifier Uses

func ParseIdentifier(ident string) IdentifierExpression

type Inable Uses

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
}

Behaviors

type InsertClauses Uses

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

    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 Uses

func NewInsertClauses() InsertClauses

type InsertExpression Uses

type InsertExpression interface {
    Expression
    IsEmpty() bool
    IsInsertFrom() bool
    From() AppendableExpression
    Cols() ColumnListExpression
    SetCols(cols ColumnListExpression) InsertExpression
    Vals() [][]interface{}
    SetVals([][]interface{}) InsertExpression
}

func NewInsertExpression Uses

func NewInsertExpression(rows ...interface{}) (insertExpression InsertExpression, err error)

type Isable Uses

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
}

Behaviors

type JoinCondition Uses

type JoinCondition interface {
    Type() JoinConditionType
    IsEmpty() bool
}

func NewJoinOnCondition Uses

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 Uses

func NewJoinUsingCondition(expressions ...interface{}) JoinCondition

Creates a new USING clause to be used within a join

type JoinConditionType Uses

type JoinConditionType int

type JoinExpression Uses

type JoinExpression interface {
    Expression
    JoinType() JoinType
    IsConditioned() bool
    Table() Expression
}

func NewUnConditionedJoinExpression Uses

func NewUnConditionedJoinExpression(joinType JoinType, table Expression) JoinExpression

type JoinExpressions Uses

type JoinExpressions []JoinExpression

func (JoinExpressions) Clone Uses

func (jes JoinExpressions) Clone() JoinExpressions

type JoinOnCondition Uses

type JoinOnCondition interface {
    JoinCondition
    On() ExpressionList
}

type JoinType Uses

type JoinType int

func (JoinType) String Uses

func (jt JoinType) String() string

type JoinUsingCondition Uses

type JoinUsingCondition interface {
    JoinCondition
    Using() ColumnListExpression
}

type LateralExpression Uses

type LateralExpression interface {
    Expression
    Aliaseable
    Table() AppendableExpression
}

func NewLateralExpression Uses

func NewLateralExpression(table AppendableExpression) LateralExpression

Creates a new SQL lateral expression

L(From("test")) -> LATERAL (SELECT * FROM "tests")

type Likeable Uses

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
}

Behaviors

type LiteralExpression Uses

type LiteralExpression interface {
    Expression
    Aliaseable
    Comparable
    Isable
    Inable
    Likeable
    Rangeable
    Orderable
    // Returns the literal sql
    Literal() string
    // Arguments to be replaced within the sql
    Args() []interface{}
}

Expression for representing "literal" sql.

L("col = 1") -> col = 1)
L("? = ?", I("col"), 1) -> "col" = 1

func Default Uses

func Default() LiteralExpression

Returns a literal for the 'DEFAULT'

func NewLiteralExpression Uses

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 Uses

func Star() LiteralExpression

Returns a literal for the '*' operator

type Lock Uses

type Lock interface {
    Strength() LockStrength
    WaitOption() WaitOption
}

func NewLock Uses

func NewLock(strength LockStrength, option WaitOption) Lock

type LockStrength Uses

type LockStrength int

type Op Uses

type Op map[string]interface{}

Used in tandem with the Ex map to create complex comparisons such as LIKE, GT, LT... See examples

type Orderable Uses

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
}

Interface that an expression should implement if it can be ORDERED.

type OrderedExpression Uses

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
}

An expression for specifying sort order and options

type RangeExpression Uses

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
}

type RangeOperation Uses

type RangeOperation int

func (RangeOperation) String Uses

func (ro RangeOperation) String() string

type RangeVal Uses

type RangeVal interface {
    Start() interface{}
    End() interface{}
}

func NewRangeVal Uses

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))

type Rangeable Uses

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
}

Behaviors

type Record Uses

type Record map[string]interface{}

Alternative to writing map[string]interface{}. Can be used for Inserts, Updates or Deletes

func NewRecordFromStruct Uses

func NewRecordFromStruct(i interface{}, forInsert, forUpdate bool) (r Record, err error)

func (Record) Cols Uses

func (r Record) Cols() []string

type SQLExpression Uses

type SQLExpression interface {
    Expression
    ToSQL() (string, []interface{}, error)
}

An Expression that generates its own sql (e.g Dataset)

type SQLFunctionExpression Uses

type SQLFunctionExpression interface {
    Expression
    Aliaseable
    Rangeable
    Comparable
    Isable
    Inable
    Likeable
    Windowable
    // The function name
    Name() string
    // Arguments to be passed to the function
    Args() []interface{}
}

Expression for representing a SQLFunction(e.g. COUNT, SUM, MIN, MAX...)

func NewSQLFunctionExpression Uses

func NewSQLFunctionExpression(name string, args ...interface{}) SQLFunctionExpression

Creates a new SQLFunctionExpression with the given name and arguments

type SQLWindowFunctionExpression Uses

type SQLWindowFunctionExpression interface {
    Expression
    Aliaseable
    Rangeable
    Comparable
    Isable
    Inable
    Likeable
    Func() SQLFunctionExpression

    Window() WindowExpression
    WindowName() IdentifierExpression

    HasWindow() bool
    HasWindowName() bool
}

func NewSQLWindowFunctionExpression Uses

func NewSQLWindowFunctionExpression(
    fn SQLFunctionExpression,
    windowName IdentifierExpression,
    window WindowExpression) SQLWindowFunctionExpression

type SelectClauses Uses

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

    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 Uses

func NewSelectClauses() SelectClauses

type TruncateClauses Uses

type TruncateClauses interface {
    HasTable() bool

    Table() ColumnListExpression
    SetTable(tables ColumnListExpression) TruncateClauses

    Options() TruncateOptions
    SetOptions(opts TruncateOptions) TruncateClauses
    // contains filtered or unexported methods
}

func NewTruncateClauses Uses

func NewTruncateClauses() TruncateClauses

type TruncateOptions Uses

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
}

Options to use when generating a TRUNCATE statement

type UpdateClauses Uses

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 Uses

func NewUpdateClauses() UpdateClauses

type UpdateExpression Uses

type UpdateExpression interface {
    Col() IdentifierExpression
    Val() interface{}
}

func NewUpdateExpressions Uses

func NewUpdateExpressions(update interface{}) (updates []UpdateExpression, err error)

type Updateable Uses

type Updateable interface {
    // Used internally by update sql
    Set(interface{}) UpdateExpression
}

Behaviors

type Vals Uses

type Vals []interface{}

type WaitOption Uses

type WaitOption int

type WindowExpression Uses

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 Uses

func NewWindowExpression(window, parent IdentifierExpression, partitionCols, orderCols ColumnListExpression) WindowExpression

type Windowable Uses

type Windowable interface {
    Over(WindowExpression) SQLWindowFunctionExpression
    OverName(IdentifierExpression) SQLWindowFunctionExpression
}

Package exp imports 8 packages (graph). Updated 2019-12-19. Refresh now. Tools for package owners.