plan

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2021 License: Apache-2.0 Imports: 27 Imported by: 7

Documentation

Index

Constants

View Source
const (
	InsertTrigger TriggerEvent = "insert"
	UpdateTrigger              = "update"
	DeleteTrigger              = "delete"
)
View Source
const (
	TmpfileName = ".LOADFILE"
)

Variables

View Source
var (
	// ErrNoCheckConstraintSupport is returned when the table does not support CONSTRAINT CHECK operations.
	ErrNoCheckConstraintSupport = errors.NewKind("the table does not support check constraint operations: %s")

	// ErrCheckFailed is returned when the check constraint evaluates to false
	ErrCheckFailed = errors.NewKind("check constraint %s is violated.")
)
View Source
var (
	// ErrNoForeignKeySupport is returned when the table does not support FOREIGN KEY operations.
	ErrNoForeignKeySupport = errors.NewKind("the table does not support foreign key operations: %s")
	// ErrForeignKeyMissingColumns is returned when an ALTER TABLE ADD FOREIGN KEY statement does not provide any columns
	ErrForeignKeyMissingColumns = errors.NewKind("cannot create a foreign key without columns")
	// ErrAddForeignKeyDuplicateColumn is returned when an ALTER TABLE ADD FOREIGN KEY statement has the same column multiple times
	ErrAddForeignKeyDuplicateColumn = errors.NewKind("cannot have duplicates of columns in a foreign key: `%v`")
	// ErrTemporaryTablesForeignKeySupport is returns when a user tries to create a temporary table with a foreign key
	ErrTemporaryTablesForeignKeySupport = errors.NewKind("temporary tables do not support foreign keys")
)
View Source
var (
	// ErrIndexActionNotImplemented is returned when the action has not been implemented
	ErrIndexActionNotImplemented = errors.NewKind("alter table index action is not implemented: %v")
	// ErrCreateIndexMissingColumns is returned when a CREATE INDEX statement does not provide any columns
	ErrCreateIndexMissingColumns = errors.NewKind("cannot create an index without columns")
	// ErrCreateIndexNonExistentColumn is returned when a key is provided in the index that isn't in the table
	ErrCreateIndexNonExistentColumn = errors.NewKind("column `%v` does not exist in the table")
	// ErrCreateIndexDuplicateColumn is returned when a CREATE INDEX statement has the same column multiple times
	ErrCreateIndexDuplicateColumn = errors.NewKind("cannot have duplicates of columns in an index: `%v`")
)
View Source
var (
	// ErrNotIndexable is returned when the table is not indexable.
	ErrNotIndexable = errors.NewKind("the table is not indexable")

	// ErrInvalidIndexDriver is returned when the index driver can't be found.
	ErrInvalidIndexDriver = errors.NewKind("invalid driver index %q")

	// ErrExprTypeNotIndexable is returned when the expression type cannot be
	// indexed, such as BLOB or JSON.
	ErrExprTypeNotIndexable = errors.NewKind("expression %q with type %s cannot be indexed")
)
View Source
var (
	// ErrIndexNotFound is returned when the index cannot be found.
	ErrIndexNotFound = errors.NewKind("unable to find index %q on table %q of database %q")
	// ErrTableNotValid is returned when the table is not valid
	ErrTableNotValid = errors.NewKind("table is not valid")
	// ErrTableNotNameable is returned when the table is not nameable.
	ErrTableNotNameable = errors.NewKind("can't get name from table")
	// ErrIndexNotAvailable is returned when trying to delete an index that is
	// still not ready for usage.
	ErrIndexNotAvailable = errors.NewKind("index %q is still not ready for usage and can't be deleted")
)
View Source
var DescribeSchema = sql.Schema{
	{Name: "plan", Type: sql.LongText},
}

DescribeSchema is the schema returned by a DescribeQuery node.

View Source
var EmptyTable = new(emptyTable)

EmptyTable is a node representing an empty table.

View Source
var ErrAlterTableNotSupported = errors.NewKind("table %s cannot be altered on database %s")

ErrAlterTableNotSupported is thrown when the database doesn't support ALTER TABLE statements

View Source
var ErrAutoIncrementNotSupported = errors.NewKind("table doesn't support AUTO_INCREMENT")
View Source
var ErrCreateTableNotSupported = errors.NewKind("tables cannot be created on database %s")

ErrCreateTable is thrown when the database doesn't support table creation

View Source
var ErrDeleteFromNotSupported = errors.NewKind("table doesn't support DELETE FROM")
View Source
var ErrDropTableNotSupported = errors.NewKind("tables cannot be dropped on database %s")

ErrDropTableNotSupported is thrown when the database doesn't support dropping tables

View Source
var ErrGroupBy = errors.NewKind("group by aggregation '%v' not supported")

ErrGroupBy is returned when the aggregation is not supported.

View Source
var ErrInsertIgnore = errors.NewKind("This row was ignored") // Used for making sure the row accumulator is correct
View Source
var ErrInsertIntoDuplicateColumn = errors.NewKind("duplicate column name %v")
View Source
var ErrInsertIntoIncompatibleTypes = errors.NewKind("cannot convert type %s to %s")
View Source
var ErrInsertIntoMismatchValueCount = errors.NewKind("number of values does not match number of columns provided")
View Source
var ErrInsertIntoNonexistentColumn = errors.NewKind("invalid column name %v")
View Source
var ErrInsertIntoNotSupported = errors.NewKind("table doesn't support INSERT INTO")

ErrInsertIntoNotSupported is thrown when a table doesn't support inserts

View Source
var ErrInsertIntoUnsupportedValues = errors.NewKind("%T is unsupported for inserts")
View Source
var ErrNoIndexableTable = errors.NewKind("expected an IndexableTable, couldn't find one in %v")
View Source
var ErrNoIndexedTableAccess = errors.NewKind("expected an IndexedTableAccess, couldn't find one in %v")
View Source
var ErrNoPartitionable = errors.NewKind("no partitionable node found in exchange tree")

ErrNoPartitionable is returned when no Partitionable node is found in the Exchange tree.

View Source
var ErrNotPrimaryKeyAlterable = errors.NewKind("error: table is not primary key alterable")

ErrNotPrimaryKeyAlterable is return when a table cannot be determines to be primary key alterable

View Source
var ErrNotView = errors.NewKind("'%' is not VIEW")
View Source
var ErrNullDefault = errors.NewKind("column declared not null must have a non-null default value")

ErrNullDefault is thrown when a non-null column is added with a null default

View Source
var ErrOnDuplicateKeyUpdateNotSupported = errors.NewKind("table doesn't support ON DUPLICATE KEY UPDATE")
View Source
var ErrRenameTableNotSupported = errors.NewKind("tables cannot be renamed on database %s")

ErrRenameTableNotSupported is thrown when the database doesn't support renaming tables

View Source
var ErrReplaceIntoNotSupported = errors.NewKind("table doesn't support REPLACE INTO")
View Source
var ErrTableCreatedNotFound = errors.NewKind("table was created but could not be found")

ErrTableCreatedNotFound is thrown when a table is created from CREATE TABLE but cannot be found immediately afterward

View Source
var ErrTableNotLockable = errors.NewKind("table %s is not lockable")

ErrTableNotLockable is returned whenever a lockable table can't be found.

View Source
var ErrTruncateNotSupported = errors.NewKind("table doesn't support TRUNCATE")
View Source
var ErrUnresolvedTable = errors.NewKind("unresolved table")

ErrUnresolvedTable is thrown when a table cannot be resolved

View Source
var ErrUpdateNotSupported = errors.NewKind("table doesn't support UPDATE")
View Source
var ErrUpdateUnexpectedSetResult = errors.NewKind("attempted to set field but expression returned %T")

cc: https://dev.mysql.com/doc/refman/8.0/en/sql-mode.html#sql-mode-strict The INSERT IGNORE syntax applies to these ignorable errors ER_BAD_NULL_ERROR - yes ER_DUP_ENTRY - yes ER_DUP_ENTRY_WITH_KEY_NAME - Yes ER_DUP_KEY - kinda ER_NO_PARTITION_FOR_GIVEN_VALUE - yes ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT - No ER_NO_REFERENCED_ROW_2 - Yes ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET - No ER_ROW_IS_REFERENCED_2 - Yes ER_SUBQUERY_NO_1_ROW - yes ER_VIEW_CHECK_FAILED - No

View Source
var Nothing nothing

Nothing is a node that will return no rows.

Functions

func ApplyBindings

func ApplyBindings(ctx *sql.Context, n sql.Node, bindings map[string]sql.Expression) (sql.Node, error)

ApplyBindings replaces all `BindVar` expressions in the given sql.Node with their corresponding sql.Expression entries in the provided |bindings| map. If a binding for a |BindVar| expression is not found in the map, no error is returned and the |BindVar| expression is left in place. There is no check on whether all entries in |bindings| are used at least once throughout the |n|.

This applies binding substitutions across *SubqueryAlias nodes, but will fail to apply bindings across other |sql.Opaque| nodes.

func GetColumnFromIndexExpr

func GetColumnFromIndexExpr(expr string, table sql.Table) *sql.Column

GetColumnFromIndexExpr returns column from the table given using the expression string given, in the form "table.column". Returns nil if the expression doesn't represent a column.

func GetColumnsAndPrepareExpressions

func GetColumnsAndPrepareExpressions(
	ctx *sql.Context,
	exprs []sql.Expression,
) ([]string, []sql.Expression, error)

GetColumnsAndPrepareExpressions extracts the unique columns required by all those expressions and fixes the indexes of the GetFields in the expressions to match a row with only the returned columns in that same order.

func GetInsertable

func GetInsertable(node sql.Node) (sql.InsertableTable, error)

func GetTruncatable

func GetTruncatable(node sql.Node) (sql.TruncateableTable, error)

func Inspect

func Inspect(node sql.Node, f func(sql.Node) bool)

Inspect traverses the plan in depth-first order: It starts by calling f(node); node must not be nil. If f returns true, Inspect invokes f recursively for each of the children of node, followed by a call of f(nil).

func InspectExpressions

func InspectExpressions(node sql.Node, f func(sql.Expression) bool)

InspectExpressions traverses the plan and calls sql.Inspect on any expression it finds.

func InspectExpressionsWithNode

func InspectExpressionsWithNode(node sql.Node, f func(sql.Node, sql.Expression) bool)

InspectExpressionsWithNode traverses the plan and calls sql.Inspect on any expression it finds.

func IsBinary

func IsBinary(node sql.Node) bool

IsBinary returns whether the node is binary or not.

func IsDDLNode added in v0.10.0

func IsDDLNode(node sql.Node) bool

func IsNoRowNode added in v0.10.0

func IsNoRowNode(node sql.Node) bool

IsNoRowNode returns whether this are node interacts only with schema and the catalog, not with any table rows.

func IsShowNode added in v0.10.0

func IsShowNode(node sql.Node) bool

func IsUnary

func IsUnary(node sql.Node) bool

IsUnary returns whether the node is unary or not.

func NewCheckDefinition added in v0.9.0

func NewCheckDefinition(ctx *sql.Context, check *sql.CheckConstraint) (*sql.CheckDefinition, error)

func NewIndexedInSubqueryFilter added in v0.9.0

func NewIndexedInSubqueryFilter(subquery *Subquery, child sql.Node, padding int, filterField *expression.GetField, equals bool) sql.Node

NewIndexedInSubqueryFilter returns an IndexedInSubqueryFilter sql.Node. The Node implements the semantics of `Filter(field IN (SELECT ...), Child)`, but runs the subquery `SELECT` first, and the makes repeated calls to `child.RowIter()` to get the matching Child rows. Typically `child` should be an `IndexedTableAccess`, and for this to be the right tradeoff, the results from `subquery` should be much smaller than the unfiltered results from `child`. `padding` is the number of `null` columns which will be appended to an incoming `Row` in the `RowIter` call because calling `Eval` on the `Subquery`, since the `Subquery` was originally expecting to expect within the scope of something like `child`. `child` itself should expect `RowIter()` calls with a single column `Row`, which will be the results from the `Subquery`. `filterField` is a `GetField` expression which will extract the field from `child` results that should be matched against the `subquery` results; this condition is still checked here because `child` is allowed to return non-matching rows. `equals` true means this node will call `subquery.Eval` and expect a single result, whereas `equals` false means this node will call `subquery.EvalMultiple` and expect 0 or more results.

func NewNotInSubquery

func NewNotInSubquery(left sql.Expression, right sql.Expression) sql.Expression

NewNotInSubquery creates a new NotInSubquery expression.

func NewShowCreateTable

func NewShowCreateTable(table sql.Node, isView bool) sql.Node

NewShowCreateTable creates a new ShowCreateTable node.

func NewShowIndexes

func NewShowIndexes(table sql.Node) sql.Node

NewShowIndexes creates a new ShowIndexes node. The node must represent a table.

func NewStripRowNode added in v0.9.0

func NewStripRowNode(child sql.Node, numCols int) sql.Node

func NewTableEditorIter added in v0.10.0

func NewTableEditorIter(ctx *sql.Context, table sql.TableEditor, wrappedIter sql.RowIter) sql.RowIter

NewTableEditorIter returns a new *tableEditorIter by wrapping the given iterator. If the "statement_boundaries" session variable is set to false, then the original iterator is returned.

func NillaryWithChildren

func NillaryWithChildren(node sql.Node, children ...sql.Node) (sql.Node, error)

NillaryNode is a node with no children. This is a common WithChildren implementation for all nodes that have none.

func ProjectRow

func ProjectRow(
	s *sql.Context,
	projections []sql.Expression,
	row sql.Row,
) (sql.Row, error)

ProjectRow evaluates a set of projections.

func TransformExpressions

func TransformExpressions(node sql.Node, f sql.TransformExprFunc) (sql.Node, error)

TransformExpressions applies a transformation function to all expressions on the given node.

func TransformExpressionsUp

func TransformExpressionsUp(node sql.Node, f sql.TransformExprFunc) (sql.Node, error)

TransformExpressionsUp applies a transformation function to all expressions on the given tree from the bottom up.

func TransformExpressionsUpWithNode

func TransformExpressionsUpWithNode(node sql.Node, f expression.TransformExprWithNodeFunc) (sql.Node, error)

TransformExpressionsUp applies a transformation function to all expressions on the given tree from the bottom up.

func TransformExpressionsWithNode

func TransformExpressionsWithNode(n sql.Node, f expression.TransformExprWithNodeFunc) (sql.Node, error)

TransformExpressions applies a transformation function to all expressions on the given node.

func TransformUp

func TransformUp(node sql.Node, f sql.TransformNodeFunc) (sql.Node, error)

TransformUp applies a transformation function to the given tree from the bottom up.

func TransformUpCtx added in v0.11.0

func TransformUpCtx(n sql.Node, s TransformSelector, f Transformer) (sql.Node, error)

TransformUpCtx transforms |n| from the bottom up, left to right, by passing each node to |f|. If |s| is non-nil, does not descend into children where |s| returns false.

func Walk

func Walk(v Visitor, node sql.Node)

Walk traverses the plan tree in depth-first order. It starts by calling v.Visit(node); node must not be nil. If the visitor returned by v.Visit(node) is not nil, Walk is invoked recursively with the returned visitor for each children of the node, followed by a call of v.Visit(nil) to the returned visitor. If v.Visit(node) returns non-nil, then all children are walked, even if one of them returns nil for v.Visit().

func WalkExpressions

func WalkExpressions(v sql.Visitor, node sql.Node)

WalkExpressions traverses the plan and calls sql.Walk on any expression it finds.

func WalkExpressionsWithNode

func WalkExpressionsWithNode(v sql.NodeVisitor, n sql.Node)

WalkExpressionsWithNode traverses the plan and calls sql.WalkWithNode on any expression it finds.

Types

type AddColumn

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

func NewAddColumn

func NewAddColumn(db sql.Database, tableName string, column *sql.Column, order *sql.ColumnOrder) *AddColumn

func (*AddColumn) Children

func (c *AddColumn) Children() []sql.Node

Children implements the Node interface.

func (*AddColumn) Column

func (a *AddColumn) Column() *sql.Column

func (*AddColumn) Database

func (c *AddColumn) Database() sql.Database

Database implements the sql.Databaser interface.

func (*AddColumn) Expressions

func (a *AddColumn) Expressions() []sql.Expression

func (*AddColumn) Order

func (a *AddColumn) Order() *sql.ColumnOrder

func (*AddColumn) Resolved

func (a *AddColumn) Resolved() bool

Resolved implements the Resolvable interface.

func (*AddColumn) RowIter

func (a *AddColumn) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

func (*AddColumn) Schema

func (a *AddColumn) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*AddColumn) String

func (a *AddColumn) String() string

func (*AddColumn) TableName

func (a *AddColumn) TableName() string

func (*AddColumn) WithChildren

func (a *AddColumn) WithChildren(children ...sql.Node) (sql.Node, error)

func (*AddColumn) WithDatabase

func (a *AddColumn) WithDatabase(db sql.Database) (sql.Node, error)

func (*AddColumn) WithExpressions

func (a *AddColumn) WithExpressions(exprs ...sql.Expression) (sql.Node, error)

type AlterAutoIncrement

type AlterAutoIncrement struct {
	UnaryNode
	// contains filtered or unexported fields
}

func NewAlterAutoIncrement

func NewAlterAutoIncrement(table sql.Node, autoVal int64) *AlterAutoIncrement

func (*AlterAutoIncrement) Execute

func (p *AlterAutoIncrement) Execute(ctx *sql.Context) error

Execute inserts the rows in the database.

func (*AlterAutoIncrement) RowIter

func (p *AlterAutoIncrement) RowIter(ctx *sql.Context, _ sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (*AlterAutoIncrement) Schema

func (p *AlterAutoIncrement) Schema() sql.Schema

func (AlterAutoIncrement) String

func (p AlterAutoIncrement) String() string

func (*AlterAutoIncrement) WithChildren

func (p *AlterAutoIncrement) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

type AlterDefaultDrop added in v0.10.0

type AlterDefaultDrop struct {
	UnaryNode
	ColumnName string
}

AlterDefaultDrop represents the ALTER COLUMN DROP DEFAULT statement.

func NewAlterDefaultDrop added in v0.10.0

func NewAlterDefaultDrop(table sql.Node, columnName string) *AlterDefaultDrop

NewAlterDefaultDrop returns a *AlterDefaultDrop node.

func (*AlterDefaultDrop) RowIter added in v0.10.0

func (d *AlterDefaultDrop) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*AlterDefaultDrop) String added in v0.10.0

func (d *AlterDefaultDrop) String() string

String implements the sql.Node interface.

func (*AlterDefaultDrop) WithChildren added in v0.10.0

func (d *AlterDefaultDrop) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the sql.Node interface.

type AlterDefaultSet added in v0.10.0

type AlterDefaultSet struct {
	UnaryNode
	ColumnName string
	Default    *sql.ColumnDefaultValue
}

AlterDefaultSet represents the ALTER COLUMN SET DEFAULT statement.

func NewAlterDefaultSet added in v0.10.0

func NewAlterDefaultSet(table sql.Node, columnName string, defVal *sql.ColumnDefaultValue) *AlterDefaultSet

NewAlterDefaultSet returns a *AlterDefaultSet node.

func (*AlterDefaultSet) Expressions added in v0.10.0

func (d *AlterDefaultSet) Expressions() []sql.Expression

Expressions implements the sql.Expressioner interface.

func (*AlterDefaultSet) Resolved added in v0.10.0

func (d *AlterDefaultSet) Resolved() bool

Resolved implements the sql.Node interface.

func (*AlterDefaultSet) RowIter added in v0.10.0

func (d *AlterDefaultSet) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*AlterDefaultSet) String added in v0.10.0

func (d *AlterDefaultSet) String() string

String implements the sql.Node interface.

func (*AlterDefaultSet) WithChildren added in v0.10.0

func (d *AlterDefaultSet) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the sql.Node interface.

func (*AlterDefaultSet) WithExpressions added in v0.10.0

func (d *AlterDefaultSet) WithExpressions(exprs ...sql.Expression) (sql.Node, error)

WithExpressions implements the sql.Expressioner interface.

type AlterIndex

type AlterIndex struct {
	// Action states whether it's a CREATE, DROP, or RENAME
	Action IndexAction
	// Table is the table that is being referenced
	Table sql.Node
	// IndexName is the index name, and in the case of a RENAME it represents the new name
	IndexName string
	// PreviousIndexName states the old name when renaming an index
	PreviousIndexName string
	// Using states whether you're using BTREE, HASH, or none
	Using sql.IndexUsing
	// Constraint specifies whether this is UNIQUE, FULLTEXT, SPATIAL, or none
	Constraint sql.IndexConstraint
	// Columns contains the column names (and possibly lengths) when creating an index
	Columns []sql.IndexColumn
	// Comment is the comment that was left at index creation, if any
	Comment string
}

func NewAlterCreateIndex

func NewAlterCreateIndex(table sql.Node, indexName string, using sql.IndexUsing, constraint sql.IndexConstraint, columns []sql.IndexColumn, comment string) *AlterIndex

func NewAlterDropIndex

func NewAlterDropIndex(table sql.Node, indexName string) *AlterIndex

func NewAlterRenameIndex

func NewAlterRenameIndex(table sql.Node, fromIndexName, toIndexName string) *AlterIndex

func (*AlterIndex) Children

func (p *AlterIndex) Children() []sql.Node

func (*AlterIndex) Execute

func (p *AlterIndex) Execute(ctx *sql.Context) error

Execute inserts the rows in the database.

func (*AlterIndex) Resolved

func (p *AlterIndex) Resolved() bool

func (*AlterIndex) RowIter

func (p *AlterIndex) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (*AlterIndex) Schema

func (p *AlterIndex) Schema() sql.Schema

Schema implements the Node interface.

func (AlterIndex) String

func (p AlterIndex) String() string

func (*AlterIndex) WithChildren

func (p *AlterIndex) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

type AlterPK added in v0.11.0

type AlterPK struct {
	Action  PKAction
	Table   sql.Node
	Columns []sql.IndexColumn
}

func NewAlterCreatePk added in v0.11.0

func NewAlterCreatePk(table sql.Node, columns []sql.IndexColumn) *AlterPK

func NewAlterDropPk added in v0.11.0

func NewAlterDropPk(table sql.Node) *AlterPK

func (AlterPK) Children added in v0.11.0

func (a AlterPK) Children() []sql.Node

func (AlterPK) Resolved added in v0.11.0

func (a AlterPK) Resolved() bool

func (AlterPK) RowIter added in v0.11.0

func (a AlterPK) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

func (AlterPK) Schema added in v0.11.0

func (a AlterPK) Schema() sql.Schema

func (AlterPK) String added in v0.11.0

func (a AlterPK) String() string

func (AlterPK) WithChildren added in v0.11.0

func (a AlterPK) WithChildren(children ...sql.Node) (sql.Node, error)

type BeginEndBlock

type BeginEndBlock struct {
	*Block
}

BeginEndBlock represents a BEGIN/END block.

func NewBeginEndBlock

func NewBeginEndBlock(block *Block) *BeginEndBlock

NewBeginEndBlock creates a new *BeginEndBlock node.

func (*BeginEndBlock) DebugString

func (b *BeginEndBlock) DebugString() string

DebugString implements the sql.DebugStringer interface.

func (*BeginEndBlock) String

func (b *BeginEndBlock) String() string

String implements the sql.Node interface.

func (*BeginEndBlock) WithChildren

func (b *BeginEndBlock) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the sql.Node interface.

type BinaryNode

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

BinaryNode is a node with two children.

func (BinaryNode) Children

func (n BinaryNode) Children() []sql.Node

Children implements the Node interface.

func (BinaryNode) Left

func (n BinaryNode) Left() sql.Node

func (BinaryNode) Resolved

func (n BinaryNode) Resolved() bool

Resolved implements the Resolvable interface.

func (BinaryNode) Right

func (n BinaryNode) Right() sql.Node

type Block added in v0.9.0

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

Block represents a collection of statements that should be executed in sequence.

func NewBlock added in v0.9.0

func NewBlock(statements []sql.Node) *Block

NewBlock creates a new *Block node.

func (*Block) Children added in v0.9.0

func (b *Block) Children() []sql.Node

Children implements the sql.Node interface.

func (*Block) DebugString added in v0.9.0

func (b *Block) DebugString() string

DebugString implements the sql.DebugStringer interface.

func (*Block) Resolved added in v0.9.0

func (b *Block) Resolved() bool

Resolved implements the sql.Node interface.

func (*Block) RowIter added in v0.9.0

func (b *Block) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*Block) Schema added in v0.9.0

func (b *Block) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*Block) String added in v0.9.0

func (b *Block) String() string

String implements the sql.Node interface.

func (*Block) WithChildren added in v0.9.0

func (b *Block) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the sql.Node interface.

type BlockRowIter added in v0.9.0

type BlockRowIter interface {
	sql.RowIter
	// RepresentingNode returns the Node that most directly represents this RowIter. For example, in the case of
	// an IF/ELSE block, the RowIter represents the Node where the condition evaluated to true.
	RepresentingNode() sql.Node
	// Schema returns the schema of this RowIter.
	Schema() sql.Schema
}

BlockRowIter is an iterator that produces rows. It is an extended interface over RowIter. This is primarily used by block statements. In order to track the schema of a sql.RowIter from nested blocks, this extended row iter returns the relevant information inside of the iter itself. In addition, the most specific top-level Node for that iter is returned, as stored procedures use that Node to determine whether the iter represents a SELECT statement.

type CachedResults added in v0.9.0

type CachedResults struct {
	UnaryNode
	// contains filtered or unexported fields
}

func NewCachedResults added in v0.9.0

func NewCachedResults(n sql.Node) *CachedResults

NewCachedResults returns a cached results plan Node, which will use a RowCache to cache results generated by Child.RowIter() and return those results for future calls to RowIter. This node is only safe to use if the Child is determinstic and is not dependent on the |row| parameter in the call to RowIter.

func (*CachedResults) DebugString added in v0.9.0

func (n *CachedResults) DebugString() string

func (*CachedResults) Dispose added in v0.9.0

func (n *CachedResults) Dispose()

func (*CachedResults) RowIter added in v0.9.0

func (n *CachedResults) RowIter(ctx *sql.Context, r sql.Row) (sql.RowIter, error)

func (*CachedResults) String added in v0.9.0

func (n *CachedResults) String() string

func (*CachedResults) WithChildren added in v0.9.0

func (n *CachedResults) WithChildren(children ...sql.Node) (sql.Node, error)

type Call added in v0.9.0

type Call struct {
	Name   string
	Params []sql.Expression
	// contains filtered or unexported fields
}

func NewCall added in v0.9.0

func NewCall(name string, params []sql.Expression) *Call

NewCall returns a *Call node.

func (*Call) Children added in v0.9.0

func (c *Call) Children() []sql.Node

Children implements the sql.Node interface.

func (*Call) Expressions added in v0.9.0

func (c *Call) Expressions() []sql.Expression

Expressions implements the sql.Expressioner interface.

func (*Call) HasProcedure added in v0.9.0

func (c *Call) HasProcedure() bool

HasProcedure returns whether a *Call has had its procedure set.

func (*Call) Resolved added in v0.9.0

func (c *Call) Resolved() bool

Resolved implements the sql.Node interface.

func (*Call) RowIter added in v0.9.0

func (c *Call) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*Call) Schema added in v0.9.0

func (c *Call) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*Call) String added in v0.9.0

func (c *Call) String() string

String implements the sql.Node interface.

func (*Call) WithChildren added in v0.9.0

func (c *Call) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the sql.Node interface.

func (*Call) WithExpressions added in v0.9.0

func (c *Call) WithExpressions(exprs ...sql.Expression) (sql.Node, error)

WithExpressions implements the sql.Expressioner interface.

func (*Call) WithParamReference added in v0.9.0

func (c *Call) WithParamReference(pRef *expression.ProcedureParamReference) *Call

WithParamReference returns a new *Call containing the given *expression.ProcedureParamReference.

func (*Call) WithProcedure added in v0.9.0

func (c *Call) WithProcedure(proc *Procedure) *Call

WithProcedure returns a new *Call containing the given *sql.Procedure.

type Characteristic added in v0.9.0

type Characteristic byte

Characteristic represents a characteristic that is defined on either a stored procedure or stored function.

const (
	Characteristic_LanguageSql Characteristic = iota
	Characteristic_Deterministic
	Characteristic_NotDeterministic
	Characteristic_ContainsSql
	Characteristic_NoSql
	Characteristic_ReadsSqlData
	Characteristic_ModifiesSqlData
)

func (Characteristic) String added in v0.9.0

func (c Characteristic) String() string

String returns the original SQL representation.

type Commit

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

Commit commits the changes performed in a transaction. This is provided just for compatibility with SQL clients and is a no-op.

func NewCommit

func NewCommit(db sql.UnresolvedDatabase) *Commit

NewCommit creates a new Commit node.

func (*Commit) Children

func (*Commit) Children() []sql.Node

Children implements the sql.Node interface.

func (*Commit) Database added in v0.10.0

func (c *Commit) Database() sql.Database

func (*Commit) Resolved

func (c *Commit) Resolved() bool

Resolved implements the sql.Node interface.

func (*Commit) RowIter

func (c *Commit) RowIter(ctx *sql.Context, _ sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*Commit) Schema

func (*Commit) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*Commit) String

func (*Commit) String() string

func (*Commit) WithChildren

func (c *Commit) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (Commit) WithDatabase added in v0.10.0

func (c Commit) WithDatabase(database sql.Database) (sql.Node, error)

type CommonTableExpression added in v0.9.0

type CommonTableExpression struct {
	Subquery *SubqueryAlias
	Columns  []string
}

func NewCommonTableExpression added in v0.9.0

func NewCommonTableExpression(subquery *SubqueryAlias, columns []string) *CommonTableExpression

func (*CommonTableExpression) DebugString added in v0.9.0

func (e *CommonTableExpression) DebugString() string

func (*CommonTableExpression) String added in v0.9.0

func (e *CommonTableExpression) String() string

type Concat added in v0.11.0

type Concat struct {
	BinaryNode
}

Concat is a node that returns everything in Left and then everything in Right, but it excludes any results in Right that already appeared in Left. Similar to Distinct(Union(...)) but allows Left to return return the same row more than once.

func NewConcat added in v0.11.0

func NewConcat(left, right sql.Node) *Concat

NewConcat creates a new Concat node with the given children.

func (Concat) DebugString added in v0.11.0

func (c Concat) DebugString() string

func (*Concat) RowIter added in v0.11.0

func (c *Concat) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (*Concat) Schema added in v0.11.0

func (c *Concat) Schema() sql.Schema

func (Concat) String added in v0.11.0

func (c Concat) String() string

func (*Concat) WithChildren added in v0.11.0

func (c *Concat) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

type CopierProps added in v0.11.0

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

type CreateCheck added in v0.9.0

type CreateCheck struct {
	UnaryNode
	Check *sql.CheckConstraint
}

func NewAlterAddCheck added in v0.9.0

func NewAlterAddCheck(table sql.Node, check *sql.CheckConstraint) *CreateCheck

func (*CreateCheck) Execute added in v0.9.0

func (c *CreateCheck) Execute(ctx *sql.Context) error

Execute inserts the rows in the database.

func (*CreateCheck) Expressions added in v0.9.0

func (c *CreateCheck) Expressions() []sql.Expression

Expressions implements the sql.Expressioner interface.

func (*CreateCheck) Resolved added in v0.9.0

func (c *CreateCheck) Resolved() bool

Resolved implements the Resolvable interface.

func (*CreateCheck) RowIter added in v0.9.0

func (c *CreateCheck) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

func (*CreateCheck) Schema added in v0.9.0

func (c *CreateCheck) Schema() sql.Schema

func (CreateCheck) String added in v0.9.0

func (c CreateCheck) String() string

func (*CreateCheck) WithChildren added in v0.9.0

func (c *CreateCheck) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (*CreateCheck) WithExpressions added in v0.9.0

func (c *CreateCheck) WithExpressions(exprs ...sql.Expression) (sql.Node, error)

WithExpressions implements the sql.Expressioner interface.

type CreateDB added in v0.9.0

type CreateDB struct {
	Catalog sql.Catalog

	IfNotExists bool
	// contains filtered or unexported fields
}

CreateDB creates an in memory database that lasts the length of the process only.

func NewCreateDatabase added in v0.9.0

func NewCreateDatabase(dbName string, ifNotExists bool) *CreateDB

func (CreateDB) Children added in v0.9.0

func (c CreateDB) Children() []sql.Node

func (CreateDB) Resolved added in v0.9.0

func (c CreateDB) Resolved() bool

func (CreateDB) RowIter added in v0.9.0

func (c CreateDB) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

func (CreateDB) Schema added in v0.9.0

func (c CreateDB) Schema() sql.Schema

func (CreateDB) String added in v0.9.0

func (c CreateDB) String() string

func (CreateDB) WithChildren added in v0.9.0

func (c CreateDB) WithChildren(children ...sql.Node) (sql.Node, error)

type CreateForeignKey

type CreateForeignKey struct {
	Table           string
	ReferencedTable string
	FkDef           *sql.ForeignKeyConstraint
	// contains filtered or unexported fields
}

func NewAlterAddForeignKey

func NewAlterAddForeignKey(db sql.Database, table, refTable string, fkDef *sql.ForeignKeyConstraint) *CreateForeignKey

func (*CreateForeignKey) Children added in v0.10.0

func (c *CreateForeignKey) Children() []sql.Node

Children implements the Node interface.

func (*CreateForeignKey) Database added in v0.10.0

func (c *CreateForeignKey) Database() sql.Database

Database implements the sql.Databaser interface.

func (*CreateForeignKey) Execute

func (p *CreateForeignKey) Execute(ctx *sql.Context) error

Execute inserts the rows in the database.

func (*CreateForeignKey) Resolved added in v0.10.0

func (c *CreateForeignKey) Resolved() bool

Resolved implements the Resolvable interface.

func (*CreateForeignKey) RowIter

func (p *CreateForeignKey) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

func (*CreateForeignKey) Schema

func (p *CreateForeignKey) Schema() sql.Schema

func (CreateForeignKey) String

func (p CreateForeignKey) String() string

func (*CreateForeignKey) WithChildren

func (p *CreateForeignKey) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (*CreateForeignKey) WithDatabase added in v0.10.0

func (p *CreateForeignKey) WithDatabase(db sql.Database) (sql.Node, error)

WithDatabase implements the sql.Databaser interface.

type CreateIndex

type CreateIndex struct {
	Name            string
	Table           sql.Node
	Exprs           []sql.Expression
	Driver          string
	Config          map[string]string
	Catalog         sql.Catalog
	CurrentDatabase string
}

CreateIndex is a node to create an index.

func NewCreateIndex

func NewCreateIndex(
	name string,
	table sql.Node,
	exprs []sql.Expression,
	driver string,
	config map[string]string,
) *CreateIndex

NewCreateIndex creates a new CreateIndex node.

func (*CreateIndex) Children

func (c *CreateIndex) Children() []sql.Node

Children implements the Node interface.

func (*CreateIndex) Expressions

func (c *CreateIndex) Expressions() []sql.Expression

Expressions implements the Expressioner interface.

func (*CreateIndex) Resolved

func (c *CreateIndex) Resolved() bool

Resolved implements the Node interface.

func (*CreateIndex) RowIter

func (c *CreateIndex) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (*CreateIndex) Schema

func (c *CreateIndex) Schema() sql.Schema

Schema implements the Node interface.

func (*CreateIndex) String

func (c *CreateIndex) String() string

func (*CreateIndex) WithChildren

func (c *CreateIndex) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (*CreateIndex) WithExpressions

func (c *CreateIndex) WithExpressions(exprs ...sql.Expression) (sql.Node, error)

WithExpressions implements the Expressioner interface.

type CreateProcedure added in v0.9.0

type CreateProcedure struct {
	*Procedure
	BodyString string
	Db         sql.Database
}

func NewCreateProcedure added in v0.9.0

func NewCreateProcedure(
	name,
	definer string,
	params []ProcedureParam,
	createdAt, modifiedAt time.Time,
	securityContext ProcedureSecurityContext,
	characteristics []Characteristic,
	body sql.Node,
	comment, createString, bodyString string,
) *CreateProcedure

NewCreateProcedure returns a *CreateProcedure node.

func (*CreateProcedure) Children added in v0.9.0

func (c *CreateProcedure) Children() []sql.Node

Children implements the sql.Node interface.

func (*CreateProcedure) Database added in v0.9.0

func (c *CreateProcedure) Database() sql.Database

Database implements the sql.Databaser interface.

func (*CreateProcedure) DebugString added in v0.9.0

func (c *CreateProcedure) DebugString() string

DebugString implements the sql.DebugStringer interface.

func (*CreateProcedure) Resolved added in v0.9.0

func (c *CreateProcedure) Resolved() bool

Resolved implements the sql.Node interface.

func (*CreateProcedure) RowIter added in v0.9.0

func (c *CreateProcedure) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*CreateProcedure) Schema added in v0.9.0

func (c *CreateProcedure) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*CreateProcedure) String added in v0.9.0

func (c *CreateProcedure) String() string

String implements the sql.Node interface.

func (*CreateProcedure) WithChildren added in v0.9.0

func (c *CreateProcedure) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the sql.Node interface.

func (*CreateProcedure) WithDatabase added in v0.9.0

func (c *CreateProcedure) WithDatabase(database sql.Database) (sql.Node, error)

WithDatabase implements the sql.Databaser interface.

type CreateSavepoint added in v0.10.0

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

func NewCreateSavepoint added in v0.10.0

func NewCreateSavepoint(db sql.UnresolvedDatabase, name string) *CreateSavepoint

NewCreateSavepoint creates a new CreateSavepoint node.

func (*CreateSavepoint) Children added in v0.10.0

func (*CreateSavepoint) Children() []sql.Node

Children implements the sql.Node interface.

func (*CreateSavepoint) Database added in v0.10.0

func (c *CreateSavepoint) Database() sql.Database

func (*CreateSavepoint) Resolved added in v0.10.0

func (c *CreateSavepoint) Resolved() bool

Resolved implements the sql.Node interface.

func (*CreateSavepoint) RowIter added in v0.10.0

func (c *CreateSavepoint) RowIter(ctx *sql.Context, _ sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*CreateSavepoint) Schema added in v0.10.0

func (*CreateSavepoint) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*CreateSavepoint) String added in v0.10.0

func (c *CreateSavepoint) String() string

func (*CreateSavepoint) WithChildren added in v0.10.0

func (c *CreateSavepoint) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (CreateSavepoint) WithDatabase added in v0.10.0

func (c CreateSavepoint) WithDatabase(database sql.Database) (sql.Node, error)

type CreateTable

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

CreateTable is a node describing the creation of some table.

func NewCreateTable

func NewCreateTable(db sql.Database, name string, ifn IfNotExistsOption, temp TempTableOption, tableSpec *TableSpec) *CreateTable

NewCreateTable creates a new CreateTable node

func NewCreateTableLike

func NewCreateTableLike(db sql.Database, name string, likeTable sql.Node, ifn IfNotExistsOption, temp TempTableOption) *CreateTable

NewCreateTableLike creates a new CreateTable node for CREATE TABLE LIKE statements

func NewCreateTableSelect added in v0.11.0

func NewCreateTableSelect(db sql.Database, name string, selectNode sql.Node, tableSpec *TableSpec, ifn IfNotExistsOption, temp TempTableOption) *CreateTable

NewCreateTableSelect create a new CreateTable node for CREATE TABLE [AS] SELECT

func (*CreateTable) Children

func (c *CreateTable) Children() []sql.Node

Children implements the Node interface.

func (*CreateTable) Database

func (c *CreateTable) Database() sql.Database

Database implements the sql.Databaser interface.

func (*CreateTable) DebugString added in v0.10.0

func (c *CreateTable) DebugString() string

func (*CreateTable) Expressions

func (c *CreateTable) Expressions() []sql.Expression

func (*CreateTable) IfNotExists

func (c *CreateTable) IfNotExists() IfNotExistsOption

func (*CreateTable) Like

func (c *CreateTable) Like() sql.Node

func (*CreateTable) Name

func (c *CreateTable) Name() string

func (*CreateTable) Resolved

func (c *CreateTable) Resolved() bool

Resolved implements the Resolvable interface.

func (*CreateTable) RowIter

func (c *CreateTable) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (*CreateTable) Schema

func (c *CreateTable) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*CreateTable) Select added in v0.11.0

func (c *CreateTable) Select() sql.Node

func (*CreateTable) String

func (c *CreateTable) String() string

func (*CreateTable) TableSpec added in v0.11.0

func (c *CreateTable) TableSpec() *TableSpec

func (*CreateTable) Temporary added in v0.11.0

func (c *CreateTable) Temporary() TempTableOption

func (*CreateTable) WithChildren

func (c *CreateTable) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (*CreateTable) WithDatabase

func (c *CreateTable) WithDatabase(db sql.Database) (sql.Node, error)

WithDatabase implements the sql.Databaser interface.

func (*CreateTable) WithExpressions

func (c *CreateTable) WithExpressions(exprs ...sql.Expression) (sql.Node, error)

type CreateTrigger

type CreateTrigger struct {
	TriggerName         string
	TriggerTime         string
	TriggerEvent        string
	TriggerOrder        *TriggerOrder
	Table               sql.Node
	Body                sql.Node
	CreateTriggerString string
	BodyString          string
	CreateDatabase      sql.Database
}

func NewCreateTrigger

func NewCreateTrigger(triggerName, triggerTime, triggerEvent string, triggerOrder *TriggerOrder, table sql.Node, body sql.Node, createTriggerString, bodyString string) *CreateTrigger

func (*CreateTrigger) Children

func (c *CreateTrigger) Children() []sql.Node

func (*CreateTrigger) Database

func (c *CreateTrigger) Database() sql.Database

func (*CreateTrigger) DebugString

func (c *CreateTrigger) DebugString() string

func (*CreateTrigger) Resolved

func (c *CreateTrigger) Resolved() bool

func (*CreateTrigger) RowIter

func (c *CreateTrigger) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

func (*CreateTrigger) Schema

func (c *CreateTrigger) Schema() sql.Schema

func (*CreateTrigger) String

func (c *CreateTrigger) String() string

func (*CreateTrigger) WithChildren

func (c *CreateTrigger) WithChildren(children ...sql.Node) (sql.Node, error)

func (*CreateTrigger) WithDatabase

func (c *CreateTrigger) WithDatabase(database sql.Database) (sql.Node, error)

type CreateView

type CreateView struct {
	UnaryNode

	Name       string
	Columns    []string
	IsReplace  bool
	Definition *SubqueryAlias
	// contains filtered or unexported fields
}

CreateView is a node representing the creation (or replacement) of a view, which is defined by the Child node. The Columns member represent the explicit columns specified by the query, if any.

func NewCreateView

func NewCreateView(
	database sql.Database,
	name string,
	columns []string,
	definition *SubqueryAlias,
	isReplace bool,
) *CreateView

NewCreateView creates a CreateView node with the specified parameters, setting its catalog to nil.

func (*CreateView) Children

func (cv *CreateView) Children() []sql.Node

Children implements the Node interface. It returns the Child of the CreateView node; i.e., the definition of the view that will be created.

func (*CreateView) Database

func (cv *CreateView) Database() sql.Database

Database implements the Databaser interface, and it returns the database in which CreateView will create the view.

func (*CreateView) Resolved

func (cv *CreateView) Resolved() bool

Resolved implements the Node interface. This node is resolved if and only if the database and the Child are both resolved.

func (*CreateView) RowIter

func (cv *CreateView) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface. When executed, this function creates (or replaces) the view. It can error if the CraeteView's IsReplace member is set to false and the view already exists. The RowIter returned is always empty.

func (*CreateView) Schema

func (cv *CreateView) Schema() sql.Schema

Schema implements the Node interface. It always returns nil.

func (*CreateView) String

func (cv *CreateView) String() string

String implements the fmt.Stringer interface, using sql.TreePrinter to generate the string.

func (*CreateView) View

func (cv *CreateView) View() *sql.View

View returns the view that will be created by this node.

func (*CreateView) WithChildren

func (cv *CreateView) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface. It only succeeds if the length of the specified children equals 1.

func (*CreateView) WithDatabase

func (cv *CreateView) WithDatabase(database sql.Database) (sql.Node, error)

WithDatabase implements the Databaser interface, and it returns a copy of this node with the specified database.

type CrossJoin

type CrossJoin struct {
	BinaryNode
}

CrossJoin is a cross join between two tables.

func NewCrossJoin

func NewCrossJoin(left sql.Node, right sql.Node) *CrossJoin

NewCrossJoin creates a new cross join node from two tables.

func (*CrossJoin) DebugString

func (p *CrossJoin) DebugString() string

func (*CrossJoin) Resolved

func (p *CrossJoin) Resolved() bool

Resolved implements the Resolvable interface.

func (*CrossJoin) RowIter

func (p *CrossJoin) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (*CrossJoin) Schema

func (p *CrossJoin) Schema() sql.Schema

Schema implements the Node interface.

func (*CrossJoin) String

func (p *CrossJoin) String() string

func (*CrossJoin) WithChildren

func (p *CrossJoin) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

type DeclareCondition added in v0.9.0

type DeclareCondition struct {
	Name          string
	MysqlErrCode  int64
	SqlStateValue string
}

DeclareCondition represents the DECLARE ... CONDITION statement.

func NewDeclareCondition added in v0.9.0

func NewDeclareCondition(name string, errCode int64, sqlStateValue string) *DeclareCondition

NewDeclareCondition returns a *DeclareCondition node.

func (*DeclareCondition) Children added in v0.9.0

func (d *DeclareCondition) Children() []sql.Node

Children implements the sql.Node interface.

func (*DeclareCondition) Resolved added in v0.9.0

func (d *DeclareCondition) Resolved() bool

Resolved implements the sql.Node interface.

func (*DeclareCondition) RowIter added in v0.9.0

func (d *DeclareCondition) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*DeclareCondition) Schema added in v0.9.0

func (d *DeclareCondition) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*DeclareCondition) String added in v0.9.0

func (d *DeclareCondition) String() string

String implements the sql.Node interface.

func (*DeclareCondition) WithChildren added in v0.9.0

func (d *DeclareCondition) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the sql.Node interface.

type DecoratedNode

type DecoratedNode struct {
	UnaryNode
	// contains filtered or unexported fields
}

DecoratedNode represents a plan node that has been decorated to illustrate some aspect of the query plan

func NewDecoratedNode

func NewDecoratedNode(decoration string, node sql.Node) *DecoratedNode

NewDecoratedNode creates a new instance of DecoratedNode wrapping the node given, with the Deocration string given.

func (*DecoratedNode) DebugString

func (n *DecoratedNode) DebugString() string

func (*DecoratedNode) RowIter

func (n *DecoratedNode) RowIter(context *sql.Context, row sql.Row) (sql.RowIter, error)

func (*DecoratedNode) String

func (n *DecoratedNode) String() string

func (*DecoratedNode) WithChildren

func (n *DecoratedNode) WithChildren(children ...sql.Node) (sql.Node, error)

type DecorationType

type DecorationType byte

type DeleteFrom

type DeleteFrom struct {
	UnaryNode
}

DeleteFrom is a node describing a deletion from some table.

func NewDeleteFrom

func NewDeleteFrom(n sql.Node) *DeleteFrom

NewDeleteFrom creates a DeleteFrom node.

func (*DeleteFrom) Database added in v0.9.0

func (p *DeleteFrom) Database() string

func (DeleteFrom) DebugString

func (p DeleteFrom) DebugString() string

func (*DeleteFrom) RowIter

func (p *DeleteFrom) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (DeleteFrom) String

func (p DeleteFrom) String() string

func (*DeleteFrom) WithChildren

func (p *DeleteFrom) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

type Describe

type Describe struct {
	UnaryNode
}

Describe is a node that describes its children.

func NewDescribe

func NewDescribe(child sql.Node) *Describe

NewDescribe creates a new Describe node.

func (*Describe) RowIter

func (d *Describe) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (*Describe) Schema

func (d *Describe) Schema() sql.Schema

Schema implements the Node interface.

func (Describe) String

func (d Describe) String() string

func (*Describe) WithChildren

func (d *Describe) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

type DescribeQuery

type DescribeQuery struct {
	Format string
	// contains filtered or unexported fields
}

DescribeQuery returns the description of the query plan.

func NewDescribeQuery

func NewDescribeQuery(format string, child sql.Node) *DescribeQuery

NewDescribeQuery creates a new DescribeQuery node.

func (*DescribeQuery) Children added in v0.9.0

func (d *DescribeQuery) Children() []sql.Node

func (*DescribeQuery) DebugString

func (d *DescribeQuery) DebugString() string

func (*DescribeQuery) Query added in v0.9.0

func (d *DescribeQuery) Query() sql.Node

Query returns the query node being described

func (*DescribeQuery) Resolved added in v0.9.0

func (d *DescribeQuery) Resolved() bool

func (*DescribeQuery) RowIter

func (d *DescribeQuery) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (*DescribeQuery) Schema

func (d *DescribeQuery) Schema() sql.Schema

Schema implements the Node interface.

func (*DescribeQuery) String

func (d *DescribeQuery) String() string

func (*DescribeQuery) WithChildren

func (d *DescribeQuery) WithChildren(node ...sql.Node) (sql.Node, error)

func (*DescribeQuery) WithQuery added in v0.9.0

func (d *DescribeQuery) WithQuery(child sql.Node) sql.Node

WithQuery returns a copy of this node with the query node given

type Distinct

type Distinct struct {
	UnaryNode
}

Distinct is a node that ensures all rows that come from it are unique.

func NewDistinct

func NewDistinct(child sql.Node) *Distinct

NewDistinct creates a new Distinct node.

func (Distinct) DebugString

func (d Distinct) DebugString() string

func (*Distinct) Resolved

func (d *Distinct) Resolved() bool

Resolved implements the Resolvable interface.

func (*Distinct) RowIter

func (d *Distinct) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (Distinct) String

func (d Distinct) String() string

func (*Distinct) WithChildren

func (d *Distinct) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

type DropCheck added in v0.9.0

type DropCheck struct {
	UnaryNode
	Name string
}

func NewAlterDropCheck added in v0.9.0

func NewAlterDropCheck(table sql.Node, name string) *DropCheck

func (*DropCheck) Execute added in v0.9.0

func (p *DropCheck) Execute(ctx *sql.Context) error

Execute inserts the rows in the database.

func (*DropCheck) RowIter added in v0.9.0

func (p *DropCheck) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (*DropCheck) Schema added in v0.9.0

func (p *DropCheck) Schema() sql.Schema

func (DropCheck) String added in v0.9.0

func (p DropCheck) String() string

func (*DropCheck) WithChildren added in v0.9.0

func (p *DropCheck) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

type DropColumn

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

func NewDropColumn

func NewDropColumn(db sql.Database, tableName string, column string) *DropColumn

func (*DropColumn) Children

func (c *DropColumn) Children() []sql.Node

Children implements the Node interface.

func (*DropColumn) Database

func (c *DropColumn) Database() sql.Database

Database implements the sql.Databaser interface.

func (*DropColumn) Resolved

func (c *DropColumn) Resolved() bool

Resolved implements the Resolvable interface.

func (*DropColumn) RowIter

func (d *DropColumn) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

func (*DropColumn) Schema

func (*DropColumn) Schema() sql.Schema

Schema implements the Node interface.

func (*DropColumn) String

func (d *DropColumn) String() string

func (*DropColumn) WithChildren

func (d *DropColumn) WithChildren(children ...sql.Node) (sql.Node, error)

func (*DropColumn) WithDatabase

func (d *DropColumn) WithDatabase(db sql.Database) (sql.Node, error)

type DropConstraint added in v0.10.0

type DropConstraint struct {
	UnaryNode
	Name string
}

DropConstraint is a temporary node to handle dropping a named constraint on a table. The type of the constraint is not known, and is determined during analysis.

func NewDropConstraint added in v0.10.0

func NewDropConstraint(table *UnresolvedTable, name string) *DropConstraint

NewDropConstraint returns a new DropConstraint node

func (*DropConstraint) RowIter added in v0.10.0

func (d *DropConstraint) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

func (*DropConstraint) String added in v0.10.0

func (d *DropConstraint) String() string

func (DropConstraint) WithChildren added in v0.10.0

func (d DropConstraint) WithChildren(children ...sql.Node) (sql.Node, error)

type DropDB added in v0.9.0

type DropDB struct {
	Catalog sql.Catalog

	IfExists bool
	// contains filtered or unexported fields
}

DropDB removes a databases from the Catalog and updates the active database if it gets removed itself.

func NewDropDatabase added in v0.9.0

func NewDropDatabase(dbName string, ifExists bool) *DropDB

func (DropDB) Children added in v0.9.0

func (d DropDB) Children() []sql.Node

func (DropDB) Resolved added in v0.9.0

func (d DropDB) Resolved() bool

func (DropDB) RowIter added in v0.9.0

func (d DropDB) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

func (DropDB) Schema added in v0.9.0

func (d DropDB) Schema() sql.Schema

func (DropDB) String added in v0.9.0

func (d DropDB) String() string

func (DropDB) WithChildren added in v0.9.0

func (d DropDB) WithChildren(children ...sql.Node) (sql.Node, error)

type DropForeignKey

type DropForeignKey struct {
	UnaryNode
	Name string
}

func NewAlterDropForeignKey

func NewAlterDropForeignKey(table sql.Node, name string) *DropForeignKey

func (*DropForeignKey) Execute

func (p *DropForeignKey) Execute(ctx *sql.Context) error

Execute inserts the rows in the database.

func (*DropForeignKey) RowIter

func (p *DropForeignKey) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (*DropForeignKey) Schema

func (p *DropForeignKey) Schema() sql.Schema

func (DropForeignKey) String

func (p DropForeignKey) String() string

func (*DropForeignKey) WithChildren

func (p *DropForeignKey) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

type DropIndex

type DropIndex struct {
	Name            string
	Table           sql.Node
	Catalog         sql.Catalog
	CurrentDatabase string
}

DropIndex is a node to drop an index.

func NewDropIndex

func NewDropIndex(name string, table sql.Node) *DropIndex

NewDropIndex creates a new DropIndex node.

func (*DropIndex) Children

func (d *DropIndex) Children() []sql.Node

Children implements the Node interface.

func (*DropIndex) Resolved

func (d *DropIndex) Resolved() bool

Resolved implements the Node interface.

func (*DropIndex) RowIter

func (d *DropIndex) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (*DropIndex) Schema

func (d *DropIndex) Schema() sql.Schema

Schema implements the Node interface.

func (*DropIndex) String

func (d *DropIndex) String() string

func (*DropIndex) WithChildren

func (d *DropIndex) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

type DropProcedure added in v0.9.0

type DropProcedure struct {
	IfExists      bool
	ProcedureName string
	// contains filtered or unexported fields
}

func NewDropProcedure added in v0.9.0

func NewDropProcedure(db sql.Database, procedureName string, ifExists bool) *DropProcedure

NewDropProcedure creates a new *DropProcedure node.

func (*DropProcedure) Children added in v0.9.0

func (d *DropProcedure) Children() []sql.Node

Children implements the sql.Node interface.

func (*DropProcedure) Database added in v0.9.0

func (d *DropProcedure) Database() sql.Database

Database implements the sql.Databaser interface.

func (*DropProcedure) Resolved added in v0.9.0

func (d *DropProcedure) Resolved() bool

Resolved implements the sql.Node interface.

func (*DropProcedure) RowIter added in v0.9.0

func (d *DropProcedure) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*DropProcedure) Schema added in v0.9.0

func (d *DropProcedure) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*DropProcedure) String added in v0.9.0

func (d *DropProcedure) String() string

String implements the sql.Node interface.

func (*DropProcedure) WithChildren added in v0.9.0

func (d *DropProcedure) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the sql.Node interface.

func (*DropProcedure) WithDatabase added in v0.9.0

func (d *DropProcedure) WithDatabase(db sql.Database) (sql.Node, error)

WithDatabase implements the sql.Databaser interface.

type DropTable

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

DropTable is a node describing dropping one or more tables

func NewDropTable

func NewDropTable(db sql.Database, ifExists bool, tableNames ...string) *DropTable

NewDropTable creates a new DropTable node

func (*DropTable) Children

func (c *DropTable) Children() []sql.Node

Children implements the Node interface.

func (*DropTable) Database

func (c *DropTable) Database() sql.Database

Database implements the sql.Databaser interface.

func (*DropTable) Resolved

func (c *DropTable) Resolved() bool

Resolved implements the Resolvable interface.

func (*DropTable) RowIter

func (d *DropTable) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (*DropTable) Schema

func (*DropTable) Schema() sql.Schema

Schema implements the Node interface.

func (*DropTable) String

func (d *DropTable) String() string

func (*DropTable) TableNames

func (d *DropTable) TableNames() []string

TableNames returns the names of the tables to drop.

func (*DropTable) WithChildren

func (d *DropTable) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (*DropTable) WithDatabase

func (d *DropTable) WithDatabase(db sql.Database) (sql.Node, error)

WithDatabase implements the sql.Databaser interface.

func (*DropTable) WithTriggers

func (d *DropTable) WithTriggers(triggers []string) sql.Node

WithTriggers returns this node but with the given triggers.

type DropTrigger

type DropTrigger struct {
	IfExists    bool
	TriggerName string
	// contains filtered or unexported fields
}

func NewDropTrigger

func NewDropTrigger(db sql.Database, trigger string, ifExists bool) *DropTrigger

NewDropTrigger creates a new NewDropTrigger node for DROP TRIGGER statements.

func (*DropTrigger) Children

func (d *DropTrigger) Children() []sql.Node

Children implements the sql.Node interface.

func (*DropTrigger) Database

func (d *DropTrigger) Database() sql.Database

Database implements the sql.Databaser interface.

func (*DropTrigger) Resolved

func (d *DropTrigger) Resolved() bool

Resolved implements the sql.Node interface.

func (*DropTrigger) RowIter

func (d *DropTrigger) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*DropTrigger) Schema

func (d *DropTrigger) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*DropTrigger) String

func (d *DropTrigger) String() string

String implements the sql.Node interface.

func (*DropTrigger) WithChildren

func (d *DropTrigger) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the sql.Node interface.

func (*DropTrigger) WithDatabase

func (d *DropTrigger) WithDatabase(db sql.Database) (sql.Node, error)

WithDatabase implements the sql.Databaser interface.

type DropView

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

DropView is a node representing the removal of a list of views, defined by the children member. The flag ifExists represents whether the user wants the node to fail if any of the views in children does not exist.

func NewDropView

func NewDropView(children []sql.Node, ifExists bool) *DropView

NewDropView creates a DropView node with the specified parameters, setting its catalog to nil.

func (*DropView) Children

func (dvs *DropView) Children() []sql.Node

Children implements the Node interface. It returns the children of the CreateView node; i.e., all the views that will be dropped.

func (*DropView) Resolved

func (dvs *DropView) Resolved() bool

Resolved implements the Node interface. This node is resolved if and only if all of its children are resolved.

func (*DropView) RowIter

func (dvs *DropView) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface. When executed, this function drops all the views defined by the node's children. It errors if the flag ifExists is set to false and there is some view that does not exist.

func (*DropView) Schema

func (dvs *DropView) Schema() sql.Schema

Schema implements the Node interface. It always returns nil.

func (*DropView) String

func (dvs *DropView) String() string

String implements the fmt.Stringer interface, using sql.TreePrinter to generate the string.

func (*DropView) WithChildren

func (dvs *DropView) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface. It always suceeds, returning a copy of this node with the new array of nodes as children.

type DummyResolvedDB

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

DummyResolvedDB is a transient database useful only for instances where a database is not available but required. No tables are persisted, nor will be returned.

func NewDummyResolvedDB

func NewDummyResolvedDB(name string) *DummyResolvedDB

NewDummyResolvedDB creates a new dummy database with the given name.

func (*DummyResolvedDB) AddTable

func (d *DummyResolvedDB) AddTable(name string, t sql.Table)

func (*DummyResolvedDB) CreateTable

func (d *DummyResolvedDB) CreateTable(ctx *sql.Context, name string, schema sql.Schema) error

func (*DummyResolvedDB) DropTable

func (d *DummyResolvedDB) DropTable(ctx *sql.Context, name string) error

func (*DummyResolvedDB) GetTableInsensitive

func (d *DummyResolvedDB) GetTableInsensitive(ctx *sql.Context, tblName string) (sql.Table, bool, error)

func (*DummyResolvedDB) GetTableNames

func (d *DummyResolvedDB) GetTableNames(ctx *sql.Context) ([]string, error)

func (*DummyResolvedDB) Name

func (d *DummyResolvedDB) Name() string

func (*DummyResolvedDB) RenameTable

func (d *DummyResolvedDB) RenameTable(ctx *sql.Context, oldName, newName string) error

func (*DummyResolvedDB) Tables

func (d *DummyResolvedDB) Tables() map[string]sql.Table

type EvalPartitionKeyValueIter

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

func NewEvalPartitionKeyValueIter

func NewEvalPartitionKeyValueIter(ctx *sql.Context, iter sql.PartitionIndexKeyValueIter, columns []string, exprs []sql.Expression) *EvalPartitionKeyValueIter

func (*EvalPartitionKeyValueIter) Close

func (i *EvalPartitionKeyValueIter) Close(ctx *sql.Context) error

func (*EvalPartitionKeyValueIter) Next

type Exchange

type Exchange struct {
	UnaryNode
	Parallelism int
}

Exchange is a node that can parallelize the underlying tree iterating partitions concurrently.

func NewExchange

func NewExchange(
	parallelism int,
	child sql.Node,
) *Exchange

NewExchange creates a new Exchange node.

func (*Exchange) DebugString

func (e *Exchange) DebugString() string

func (*Exchange) RowIter

func (e *Exchange) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*Exchange) String

func (e *Exchange) String() string

func (*Exchange) WithChildren

func (e *Exchange) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

type ExistsSubquery added in v0.11.0

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

ExistsSubquery is an expression that checks that a subquery returns a non-empty result set. It's in the plan package, instead of the expression package, because Subquery is itself in the plan package (because it functions more like a plan node than an expression in its evaluation).

func NewExistsSubquery added in v0.11.0

func NewExistsSubquery(query sql.Expression) *ExistsSubquery

NewExistsSubquery created an ExistsSubquery expression.

func (*ExistsSubquery) Children added in v0.11.0

func (e *ExistsSubquery) Children() []sql.Expression

Children implements the Expression interface.

func (*ExistsSubquery) Eval added in v0.11.0

func (e *ExistsSubquery) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the Expression interface.

func (*ExistsSubquery) IsNullable added in v0.11.0

func (e *ExistsSubquery) IsNullable() bool

IsNullable implements the Expression interface.

func (*ExistsSubquery) Resolved added in v0.11.0

func (e *ExistsSubquery) Resolved() bool

Resolved implements the Expression interface.

func (*ExistsSubquery) String added in v0.11.0

func (e *ExistsSubquery) String() string

String implements the Expression interface.

func (*ExistsSubquery) Type added in v0.11.0

func (e *ExistsSubquery) Type() sql.Type

Type implements the Expression interface.

func (*ExistsSubquery) WithChildren added in v0.11.0

func (e *ExistsSubquery) WithChildren(children ...sql.Expression) (sql.Expression, error)

WithChildren implements the Expression interface.

type Filter

type Filter struct {
	UnaryNode
	Expression sql.Expression
}

Filter skips rows that don't match a certain expression.

func NewFilter

func NewFilter(expression sql.Expression, child sql.Node) *Filter

NewFilter creates a new filter node.

func (*Filter) DebugString

func (f *Filter) DebugString() string

func (*Filter) Expressions

func (f *Filter) Expressions() []sql.Expression

Expressions implements the Expressioner interface.

func (*Filter) Resolved

func (f *Filter) Resolved() bool

Resolved implements the Resolvable interface.

func (*Filter) RowIter

func (f *Filter) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (*Filter) String

func (f *Filter) String() string

func (*Filter) WithChildren

func (f *Filter) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (*Filter) WithExpressions

func (f *Filter) WithExpressions(exprs ...sql.Expression) (sql.Node, error)

WithExpressions implements the Expressioner interface.

type FilterIter

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

FilterIter is an iterator that filters another iterator and skips rows that don't match the given condition.

func NewFilterIter

func NewFilterIter(
	ctx *sql.Context,
	cond sql.Expression,
	child sql.RowIter,
) *FilterIter

NewFilterIter creates a new FilterIter.

func (*FilterIter) Close

func (i *FilterIter) Close(ctx *sql.Context) error

Close implements the RowIter interface.

func (*FilterIter) Next

func (i *FilterIter) Next() (sql.Row, error)

Next implements the RowIter interface.

type Generate

type Generate struct {
	UnaryNode
	Column *expression.GetField
}

Generate will explode rows using a generator.

func NewGenerate

func NewGenerate(child sql.Node, col *expression.GetField) *Generate

NewGenerate creates a new generate node.

func (*Generate) Expressions

func (g *Generate) Expressions() []sql.Expression

Expressions implements the Expressioner interface.

func (*Generate) RowIter

func (g *Generate) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*Generate) Schema

func (g *Generate) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*Generate) String

func (g *Generate) String() string

func (*Generate) WithChildren

func (g *Generate) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (*Generate) WithExpressions

func (g *Generate) WithExpressions(exprs ...sql.Expression) (sql.Node, error)

WithExpressions implements the Expressioner interface.

type GroupBy

type GroupBy struct {
	UnaryNode
	SelectedExprs []sql.Expression
	GroupByExprs  []sql.Expression
}

GroupBy groups the rows by some expressions.

func NewGroupBy

func NewGroupBy(selectedExprs, groupByExprs []sql.Expression, child sql.Node) *GroupBy

NewGroupBy creates a new GroupBy node. Like Project, GroupBy is a top-level node, and contains all the fields that will appear in the output of the query. Some of these fields may be aggregate functions, some may be columns or other expressions. Unlike a project, the GroupBy also has a list of group-by expressions, which usually also appear in the list of selected expressions.

func (*GroupBy) DebugString

func (g *GroupBy) DebugString() string

func (*GroupBy) Expressions

func (g *GroupBy) Expressions() []sql.Expression

Expressions implements the Expressioner interface.

func (*GroupBy) Resolved

func (g *GroupBy) Resolved() bool

Resolved implements the Resolvable interface.

func (*GroupBy) RowIter

func (g *GroupBy) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (*GroupBy) Schema

func (g *GroupBy) Schema() sql.Schema

Schema implements the Node interface.

func (*GroupBy) String

func (g *GroupBy) String() string

func (*GroupBy) WithChildren

func (g *GroupBy) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (*GroupBy) WithExpressions

func (g *GroupBy) WithExpressions(exprs ...sql.Expression) (sql.Node, error)

WithExpressions implements the Node interface.

type HashLookup added in v0.10.0

type HashLookup struct {
	UnaryNode
	// contains filtered or unexported fields
}

func NewHashLookup added in v0.10.0

func NewHashLookup(n *CachedResults, childProjection sql.Expression, lookupProjection sql.Expression) *HashLookup

NewHashLookup returns a node that performs an indexed hash lookup of cached rows for fulfilling RowIter() calls. In particular, this node sits directly on top of a `CachedResults` node and has two expressions: a projection for hashing the Child row results and another projection for hashing the parent row values when performing a lookup. When RowIter is called, if cached results are available, it fulfills the RowIter call by performing a hash lookup on the projected results. If cached results are not available, it simply delegates to the child.

func (*HashLookup) DebugString added in v0.10.0

func (n *HashLookup) DebugString() string

func (*HashLookup) RowIter added in v0.10.0

func (n *HashLookup) RowIter(ctx *sql.Context, r sql.Row) (sql.RowIter, error)

func (*HashLookup) String added in v0.10.0

func (n *HashLookup) String() string

func (*HashLookup) WithChildren added in v0.10.0

func (n *HashLookup) WithChildren(children ...sql.Node) (sql.Node, error)

type Having

type Having struct {
	UnaryNode
	Cond sql.Expression
}

Having node is a filter that supports aggregate expressions. A having node is identical to a filter node in behaviour. The difference is that some analyzer rules work specifically on having clauses and not filters. For that reason, Having is a completely new node instead of using just filter.

func NewHaving

func NewHaving(cond sql.Expression, child sql.Node) *Having

NewHaving creates a new having node.

func (*Having) DebugString added in v0.9.0

func (h *Having) DebugString() string

func (*Having) Expressions

func (h *Having) Expressions() []sql.Expression

Expressions implements the sql.Expressioner interface.

func (*Having) Resolved

func (h *Having) Resolved() bool

Resolved implements the sql.Node interface.

func (*Having) RowIter

func (h *Having) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*Having) String

func (h *Having) String() string

func (*Having) WithChildren

func (h *Having) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (*Having) WithExpressions

func (h *Having) WithExpressions(exprs ...sql.Expression) (sql.Node, error)

WithExpressions implements the Expressioner interface.

type IfConditional added in v0.9.0

type IfConditional struct {
	Condition sql.Expression
	Body      sql.Node
}

IfConditional represents IF statements only.

func NewIfConditional added in v0.9.0

func NewIfConditional(condition sql.Expression, body sql.Node) *IfConditional

NewIfConditional creates a new *IfConditional node.

func (*IfConditional) Children added in v0.9.0

func (ic *IfConditional) Children() []sql.Node

Children implements the sql.Node interface.

func (*IfConditional) DebugString added in v0.9.0

func (ic *IfConditional) DebugString() string

DebugString implements the sql.DebugStringer interface.

func (*IfConditional) Expressions added in v0.9.0

func (ic *IfConditional) Expressions() []sql.Expression

Expressions implements the sql.Expressioner interface.

func (*IfConditional) Resolved added in v0.9.0

func (ic *IfConditional) Resolved() bool

Resolved implements the sql.Node interface.

func (*IfConditional) RowIter added in v0.9.0

func (ic *IfConditional) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*IfConditional) Schema added in v0.9.0

func (ic *IfConditional) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*IfConditional) String added in v0.9.0

func (ic *IfConditional) String() string

String implements the sql.Node interface.

func (*IfConditional) WithChildren added in v0.9.0

func (ic *IfConditional) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the sql.Node interface.

func (*IfConditional) WithExpressions added in v0.9.0

func (ic *IfConditional) WithExpressions(exprs ...sql.Expression) (sql.Node, error)

WithExpressions implements the sql.Expressioner interface.

type IfElseBlock added in v0.9.0

type IfElseBlock struct {
	IfConditionals []*IfConditional
	Else           sql.Node
}

IfElseBlock represents IF/ELSE IF/ELSE statements.

func NewIfElse added in v0.9.0

func NewIfElse(ifConditionals []*IfConditional, elseStatement sql.Node) *IfElseBlock

NewIfElse creates a new *IfElseBlock node.

func (*IfElseBlock) Children added in v0.9.0

func (ieb *IfElseBlock) Children() []sql.Node

Children implements the sql.Node interface.

func (*IfElseBlock) DebugString added in v0.9.0

func (ieb *IfElseBlock) DebugString() string

DebugString implements the sql.DebugStringer interface.

func (*IfElseBlock) Resolved added in v0.9.0

func (ieb *IfElseBlock) Resolved() bool

Resolved implements the sql.Node interface.

func (*IfElseBlock) RowIter added in v0.9.0

func (ieb *IfElseBlock) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*IfElseBlock) Schema added in v0.9.0

func (ieb *IfElseBlock) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*IfElseBlock) String added in v0.9.0

func (ieb *IfElseBlock) String() string

String implements the sql.Node interface.

func (*IfElseBlock) WithChildren added in v0.9.0

func (ieb *IfElseBlock) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the sql.Node interface.

type IfNotExistsOption added in v0.11.0

type IfNotExistsOption bool
const (
	IfNotExists       IfNotExistsOption = true
	IfNotExistsAbsent IfNotExistsOption = false
)

type InSubquery

type InSubquery struct {
	expression.BinaryExpression
}

InSubquery is an expression that checks an expression is in the result of a subquery. It's in the plan package, instead of the expression package, because Subquery is itself in the plan package (because it functions more like a plan node than an expression in its evaluation).

func NewInSubquery

func NewInSubquery(left sql.Expression, right sql.Expression) *InSubquery

NewInSubquery creates an InSubquery expression.

func (*InSubquery) Children

func (in *InSubquery) Children() []sql.Expression

Children implements the Expression interface.

func (*InSubquery) DebugString

func (in *InSubquery) DebugString() string

func (*InSubquery) Eval

func (in *InSubquery) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the Expression interface.

func (*InSubquery) String

func (in *InSubquery) String() string

func (*InSubquery) Type

func (in *InSubquery) Type() sql.Type

Type implements sql.Expression

func (*InSubquery) WithChildren

func (in *InSubquery) WithChildren(children ...sql.Expression) (sql.Expression, error)

WithChildren implements the Expression interface.

type IndexAction

type IndexAction byte
const (
	IndexAction_Create IndexAction = iota
	IndexAction_Drop
	IndexAction_Rename
)

type IndexDefinition

type IndexDefinition struct {
	IndexName  string
	Using      sql.IndexUsing
	Constraint sql.IndexConstraint
	Columns    []sql.IndexColumn
	Comment    string
}

func (*IndexDefinition) String added in v0.10.0

func (i *IndexDefinition) String() string

type IndexedInSubqueryFilter added in v0.9.0

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

func (*IndexedInSubqueryFilter) Children added in v0.9.0

func (i *IndexedInSubqueryFilter) Children() []sql.Node

func (*IndexedInSubqueryFilter) DebugString added in v0.9.0

func (i *IndexedInSubqueryFilter) DebugString() string

func (*IndexedInSubqueryFilter) Resolved added in v0.9.0

func (i *IndexedInSubqueryFilter) Resolved() bool

func (*IndexedInSubqueryFilter) RowIter added in v0.9.0

func (i *IndexedInSubqueryFilter) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

func (*IndexedInSubqueryFilter) Schema added in v0.9.0

func (i *IndexedInSubqueryFilter) Schema() sql.Schema

func (*IndexedInSubqueryFilter) String added in v0.9.0

func (i *IndexedInSubqueryFilter) String() string

func (*IndexedInSubqueryFilter) WithChildren added in v0.9.0

func (i *IndexedInSubqueryFilter) WithChildren(children ...sql.Node) (sql.Node, error)

type IndexedJoin

type IndexedJoin struct {
	// The primary and secondary table nodes. The normal meanings of Left and
	// Right in BinaryNode aren't necessarily meaningful here -- the Left node is always the primary table, and the Right
	// node is always the secondary. These may or may not correspond to the left and right tables in the written query.
	BinaryNode
	// The join condition.
	Cond sql.Expression
	// contains filtered or unexported fields
}

An IndexedJoin is a join that uses index lookups for the secondary table.

func NewIndexedJoin

func NewIndexedJoin(left, right sql.Node, joinType JoinType, cond sql.Expression, scopeLen int) *IndexedJoin

func (*IndexedJoin) DebugString

func (ij *IndexedJoin) DebugString() string

func (*IndexedJoin) JoinType

func (ij *IndexedJoin) JoinType() JoinType

JoinType returns the join type for this indexed join

func (*IndexedJoin) RowIter

func (ij *IndexedJoin) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

func (*IndexedJoin) Schema

func (ij *IndexedJoin) Schema() sql.Schema

func (*IndexedJoin) String

func (ij *IndexedJoin) String() string

func (*IndexedJoin) WithChildren

func (ij *IndexedJoin) WithChildren(children ...sql.Node) (sql.Node, error)

type IndexedTableAccess

type IndexedTableAccess struct {
	*ResolvedTable
	// contains filtered or unexported fields
}

IndexedTableAccess represents an indexed lookup of a particular ResolvedTable. The values for the key used to access the indexed table is provided in RowIter(), or during static analysis.

func NewIndexedTableAccess

func NewIndexedTableAccess(resolvedTable *ResolvedTable, index sql.Index, keyExprs []sql.Expression) *IndexedTableAccess

NewIndexedTableAccess returns a new IndexedTableAccess node with the index and key expressions given. An index lookup will be calculated and applied for the row given in RowIter().

func NewStaticIndexedTableAccess

func NewStaticIndexedTableAccess(resolvedTable *ResolvedTable, lookup sql.IndexLookup, index sql.Index, keyExprs []sql.Expression) *IndexedTableAccess

NewStaticIndexedTableAccess returns a new IndexedTableAccess node with the indexlookup given. It will be applied in RowIter() without consideration of the row given. The key expression should faithfully represent this lookup, but is only for display purposes.

func (*IndexedTableAccess) DebugString

func (i *IndexedTableAccess) DebugString() string

func (*IndexedTableAccess) Expressions

func (i *IndexedTableAccess) Expressions() []sql.Expression

Expressions implements sql.Expressioner

func (*IndexedTableAccess) RowIter

func (i *IndexedTableAccess) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

func (*IndexedTableAccess) String

func (i *IndexedTableAccess) String() string

func (*IndexedTableAccess) WithExpressions

func (i *IndexedTableAccess) WithExpressions(exprs ...sql.Expression) (sql.Node, error)

WithExpressions implements sql.Expressioner

type InnerJoin

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

InnerJoin is an inner join between two tables.

func NewInnerJoin

func NewInnerJoin(left, right sql.Node, cond sql.Expression) *InnerJoin

NewInnerJoin creates a new inner join node from two tables.

func (InnerJoin) Comment added in v0.9.0

func (j InnerJoin) Comment() string

Comment implements sql.CommentedNode

func (*InnerJoin) DebugString

func (j *InnerJoin) DebugString() string

func (InnerJoin) Expressions

func (j InnerJoin) Expressions() []sql.Expression

Expressions implements sql.Expression

func (InnerJoin) JoinCond

func (j InnerJoin) JoinCond() sql.Expression

func (*InnerJoin) JoinType

func (j *InnerJoin) JoinType() JoinType

func (*InnerJoin) Resolved

func (j *InnerJoin) Resolved() bool

Resolved implements the Resolvable interface.

func (*InnerJoin) RowIter

func (j *InnerJoin) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (*InnerJoin) Schema

func (j *InnerJoin) Schema() sql.Schema

Schema implements the Node interface.

func (*InnerJoin) String

func (j *InnerJoin) String() string

func (*InnerJoin) WithChildren

func (j *InnerJoin) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (*InnerJoin) WithComment added in v0.9.0

func (j *InnerJoin) WithComment(comment string) sql.Node

WithComment implements sql.CommentedNode

func (*InnerJoin) WithExpressions

func (j *InnerJoin) WithExpressions(exprs ...sql.Expression) (sql.Node, error)

WithExpressions implements the Expressioner interface.

func (InnerJoin) WithMultipassMode added in v0.10.0

func (j InnerJoin) WithMultipassMode() JoinNode

func (*InnerJoin) WithScopeLen added in v0.9.0

func (j *InnerJoin) WithScopeLen(i int) JoinNode

type InsertInto

type InsertInto struct {
	Destination sql.Node
	Source      sql.Node
	ColumnNames []string
	IsReplace   bool
	OnDupExprs  []sql.Expression
	Checks      sql.CheckConstraints
	Ignore      bool
	// contains filtered or unexported fields
}

InsertInto is a node describing the insertion into some table.

func NewInsertInto

func NewInsertInto(db sql.Database, dst, src sql.Node, isReplace bool, cols []string, onDupExprs []sql.Expression, ignore bool) *InsertInto

NewInsertInto creates an InsertInto node.

func (*InsertInto) Children added in v0.9.0

func (ii *InsertInto) Children() []sql.Node

func (*InsertInto) Database added in v0.9.0

func (ii *InsertInto) Database() sql.Database

func (InsertInto) DebugString

func (ii InsertInto) DebugString() string

func (*InsertInto) Expressions

func (ii *InsertInto) Expressions() []sql.Expression

func (*InsertInto) Resolved

func (ii *InsertInto) Resolved() bool

Resolved implements the Resolvable interface.

func (*InsertInto) RowIter

func (ii *InsertInto) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (*InsertInto) Schema

func (ii *InsertInto) Schema() sql.Schema

Schema implements the sql.Node interface. Insert nodes return rows that are inserted. Replaces return a concatenation of the deleted row and the inserted row. If no row was deleted, the value of those columns is nil.

func (InsertInto) String

func (ii InsertInto) String() string

func (*InsertInto) WithChildren

func (ii *InsertInto) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (*InsertInto) WithDatabase added in v0.9.0

func (ii *InsertInto) WithDatabase(database sql.Database) (sql.Node, error)

func (InsertInto) WithExpressions

func (ii InsertInto) WithExpressions(newExprs ...sql.Expression) (sql.Node, error)

func (*InsertInto) WithSource added in v0.9.0

func (ii *InsertInto) WithSource(src sql.Node) sql.Node

WithSource sets the source node for this insert, which is analyzed separately

type JoinNode

type JoinNode interface {
	sql.Node
	Left() sql.Node
	Right() sql.Node
	JoinCond() sql.Expression
	JoinType() JoinType
	Comment() string
	WithScopeLen(int) JoinNode
	WithMultipassMode() JoinNode
}

type JoinType

type JoinType byte
const (
	JoinTypeInner JoinType = iota
	JoinTypeLeft
	JoinTypeRight
)

func (JoinType) String

func (t JoinType) String() string

type LeftJoin

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

LeftJoin is a left join between two tables.

func NewLeftJoin

func NewLeftJoin(left, right sql.Node, cond sql.Expression) *LeftJoin

NewLeftJoin creates a new left join node from two tables.

func (LeftJoin) Comment added in v0.9.0

func (j LeftJoin) Comment() string

Comment implements sql.CommentedNode

func (*LeftJoin) DebugString

func (j *LeftJoin) DebugString() string

func (LeftJoin) Expressions

func (j LeftJoin) Expressions() []sql.Expression

Expressions implements sql.Expression

func (LeftJoin) JoinCond

func (j LeftJoin) JoinCond() sql.Expression

func (*LeftJoin) JoinType

func (j *LeftJoin) JoinType() JoinType

func (*LeftJoin) Resolved

func (j *LeftJoin) Resolved() bool

Resolved implements the Resolvable interface.

func (*LeftJoin) RowIter

func (j *LeftJoin) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (*LeftJoin) Schema

func (j *LeftJoin) Schema() sql.Schema

Schema implements the Node interface.

func (*LeftJoin) String

func (j *LeftJoin) String() string

func (*LeftJoin) WithChildren

func (j *LeftJoin) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (*LeftJoin) WithComment added in v0.9.0

func (j *LeftJoin) WithComment(comment string) sql.Node

WithComment implements sql.CommentedNode

func (*LeftJoin) WithExpressions

func (j *LeftJoin) WithExpressions(exprs ...sql.Expression) (sql.Node, error)

WithExpressions implements the Expressioner interface.

func (LeftJoin) WithMultipassMode added in v0.10.0

func (j LeftJoin) WithMultipassMode() JoinNode

func (*LeftJoin) WithScopeLen added in v0.9.0

func (j *LeftJoin) WithScopeLen(i int) JoinNode

type Limit

type Limit struct {
	UnaryNode
	Limit         sql.Expression
	CalcFoundRows bool
}

Limit is a node that only allows up to N rows to be retrieved.

func NewLimit

func NewLimit(size sql.Expression, child sql.Node) *Limit

NewLimit creates a new Limit node with the given size.

func (Limit) DebugString

func (l Limit) DebugString() string

func (*Limit) Expressions added in v0.10.0

func (l *Limit) Expressions() []sql.Expression

Expressions implements sql.Expressioner

func (*Limit) Resolved

func (l *Limit) Resolved() bool

Resolved implements the Resolvable interface.

func (*Limit) RowIter

func (l *Limit) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (Limit) String

func (l Limit) String() string

func (*Limit) WithChildren

func (l *Limit) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (Limit) WithExpressions added in v0.10.0

func (l Limit) WithExpressions(exprs ...sql.Expression) (sql.Node, error)

WithExpressions implements sql.Expressioner

type LoadData added in v0.9.0

type LoadData struct {
	Local              bool
	File               string
	Destination        sql.Node
	ColumnNames        []string
	ResponsePacketSent bool
	Fields             *sqlparser.Fields
	Lines              *sqlparser.Lines
	IgnoreNum          int64
	// contains filtered or unexported fields
}

func NewLoadData added in v0.9.0

func NewLoadData(local bool, file string, destination sql.Node, cols []string, fields *sqlparser.Fields, lines *sqlparser.Lines, ignoreNum int64) *LoadData

func (*LoadData) Children added in v0.9.0

func (l *LoadData) Children() []sql.Node

func (*LoadData) Resolved added in v0.9.0

func (l *LoadData) Resolved() bool

func (*LoadData) RowIter added in v0.9.0

func (l *LoadData) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

func (*LoadData) Schema added in v0.9.0

func (l *LoadData) Schema() sql.Schema

func (*LoadData) String added in v0.9.0

func (l *LoadData) String() string

func (*LoadData) WithChildren added in v0.9.0

func (l *LoadData) WithChildren(children ...sql.Node) (sql.Node, error)

type LockTables

type LockTables struct {
	Catalog sql.Catalog
	Locks   []*TableLock
}

LockTables will lock tables for the session in which it's executed.

func NewLockTables

func NewLockTables(locks []*TableLock) *LockTables

NewLockTables creates a new LockTables node.

func (*LockTables) Children

func (t *LockTables) Children() []sql.Node

Children implements the sql.Node interface.

func (*LockTables) Resolved

func (t *LockTables) Resolved() bool

Resolved implements the sql.Node interface.

func (*LockTables) RowIter

func (t *LockTables) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*LockTables) Schema

func (t *LockTables) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*LockTables) String

func (t *LockTables) String() string

func (*LockTables) WithChildren

func (t *LockTables) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

type ModifyColumn

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

func NewModifyColumn

func NewModifyColumn(db sql.Database, tableName string, columnName string, column *sql.Column, order *sql.ColumnOrder) *ModifyColumn

func (*ModifyColumn) Children

func (c *ModifyColumn) Children() []sql.Node

Children implements the Node interface.

func (*ModifyColumn) Column

func (m *ModifyColumn) Column() string

func (*ModifyColumn) Database

func (c *ModifyColumn) Database() sql.Database

Database implements the sql.Databaser interface.

func (*ModifyColumn) Expressions

func (m *ModifyColumn) Expressions() []sql.Expression

func (*ModifyColumn) NewColumn added in v0.9.0

func (m *ModifyColumn) NewColumn() *sql.Column

func (*ModifyColumn) Order

func (m *ModifyColumn) Order() *sql.ColumnOrder

func (*ModifyColumn) Resolved

func (m *ModifyColumn) Resolved() bool

Resolved implements the Resolvable interface.

func (*ModifyColumn) RowIter

func (m *ModifyColumn) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

func (*ModifyColumn) Schema

func (m *ModifyColumn) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*ModifyColumn) String

func (m *ModifyColumn) String() string

func (*ModifyColumn) TableName

func (m *ModifyColumn) TableName() string

func (*ModifyColumn) WithChildren

func (m *ModifyColumn) WithChildren(children ...sql.Node) (sql.Node, error)

func (*ModifyColumn) WithDatabase

func (m *ModifyColumn) WithDatabase(db sql.Database) (sql.Node, error)

func (*ModifyColumn) WithExpressions

func (m *ModifyColumn) WithExpressions(exprs ...sql.Expression) (sql.Node, error)

type NameAndSchema

type NameAndSchema interface {
	sql.Nameable
	Schema() sql.Schema
}

type NamedNotifyFunc

type NamedNotifyFunc func(name string)

NamedNotifyFunc is a function to notify about some event with a string argument.

type NaturalJoin

type NaturalJoin struct {
	BinaryNode
}

NaturalJoin is a join that automatically joins by all the columns with the same name. NaturalJoin is a placeholder node, it should be transformed into an INNER JOIN during analysis.

func NewNaturalJoin

func NewNaturalJoin(left, right sql.Node) *NaturalJoin

NewNaturalJoin returns a new NaturalJoin node.

func (NaturalJoin) Resolved

func (NaturalJoin) Resolved() bool

Resolved implements the Node interface.

func (NaturalJoin) RowIter

func (NaturalJoin) RowIter(*sql.Context, sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (NaturalJoin) Schema

func (NaturalJoin) Schema() sql.Schema

Schema implements the Node interface.

func (NaturalJoin) String

func (j NaturalJoin) String() string

func (*NaturalJoin) WithChildren

func (j *NaturalJoin) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

type NotifyFunc

type NotifyFunc func()

NotifyFunc is a function to notify about some event.

type Offset

type Offset struct {
	UnaryNode
	Offset sql.Expression
}

Offset is a node that skips the first N rows.

func NewOffset

func NewOffset(n sql.Expression, child sql.Node) *Offset

NewOffset creates a new Offset node.

func (*Offset) Expressions added in v0.10.0

func (o *Offset) Expressions() []sql.Expression

Expressions implements sql.Expressioner

func (*Offset) Resolved

func (o *Offset) Resolved() bool

Resolved implements the Resolvable interface.

func (*Offset) RowIter

func (o *Offset) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (Offset) String

func (o Offset) String() string

func (*Offset) WithChildren

func (o *Offset) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (*Offset) WithExpressions added in v0.10.0

func (o *Offset) WithExpressions(exprs ...sql.Expression) (sql.Node, error)

WithExpressions implements sql.Expressioner

type OrderedDistinct

type OrderedDistinct struct {
	UnaryNode
}

OrderedDistinct is a Distinct node optimized for sorted row sets. It's 2 orders of magnitude faster and uses 2 orders of magnitude less memory.

func NewOrderedDistinct

func NewOrderedDistinct(child sql.Node) *OrderedDistinct

NewOrderedDistinct creates a new OrderedDistinct node.

func (*OrderedDistinct) Resolved

func (d *OrderedDistinct) Resolved() bool

Resolved implements the Resolvable interface.

func (*OrderedDistinct) RowIter

func (d *OrderedDistinct) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (OrderedDistinct) String

func (d OrderedDistinct) String() string

func (*OrderedDistinct) WithChildren

func (d *OrderedDistinct) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

type PKAction added in v0.11.0

type PKAction byte
const (
	PrimaryKeyAction_Create PKAction = iota
	PrimaryKeyAction_Drop
)

type Procedure added in v0.9.0

type Procedure struct {
	Name                  string
	Definer               string
	Params                []ProcedureParam
	SecurityContext       ProcedureSecurityContext
	Comment               string
	Characteristics       []Characteristic
	CreateProcedureString string
	Body                  sql.Node
	CreatedAt             time.Time
	ModifiedAt            time.Time
}

Procedure is a stored procedure that may be executed using the CALL statement.

func NewProcedure added in v0.9.0

func NewProcedure(
	name string,
	definer string,
	params []ProcedureParam,
	securityContext ProcedureSecurityContext,
	comment string,
	characteristics []Characteristic,
	createProcedureString string,
	body sql.Node,
	createdAt time.Time,
	modifiedAt time.Time,
) *Procedure

NewProcedure returns a *Procedure. All names contained within are lowercase, and all methods are case-insensitive.

func (*Procedure) Children added in v0.9.0

func (p *Procedure) Children() []sql.Node

Children implements the sql.Node interface.

func (*Procedure) DebugString added in v0.9.0

func (p *Procedure) DebugString() string

DebugString implements the sql.DebugStringer interface.

func (*Procedure) Resolved added in v0.9.0

func (p *Procedure) Resolved() bool

Resolved implements the sql.Node interface.

func (*Procedure) RowIter added in v0.9.0

func (p *Procedure) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*Procedure) Schema added in v0.9.0

func (p *Procedure) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*Procedure) String added in v0.9.0

func (p *Procedure) String() string

String implements the sql.Node interface.

func (*Procedure) WithChildren added in v0.9.0

func (p *Procedure) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the sql.Node interface.

type ProcedureParam added in v0.9.0

type ProcedureParam struct {
	Direction ProcedureParamDirection // Direction is the direction of the parameter.
	Name      string                  // Name is the name of the parameter.
	Type      sql.Type                // Type is the SQL type of the parameter.
}

ProcedureParam represents the parameter of a stored procedure.

func (ProcedureParam) String added in v0.9.0

func (pp ProcedureParam) String() string

String returns the original SQL representation.

type ProcedureParamDirection added in v0.9.0

type ProcedureParamDirection byte

ProcedureParamDirection represents the use case of the stored procedure parameter.

const (
	// ProcedureParamDirection_In means the parameter passes its contained value to the stored procedure.
	ProcedureParamDirection_In ProcedureParamDirection = iota
	// ProcedureParamDirection_Inout means the parameter passes its contained value to the stored procedure, while also
	// modifying the given variable.
	ProcedureParamDirection_Inout
	// ProcedureParamDirection_Out means the parameter variable will be modified, but will not be read from within the
	// stored procedure.
	ProcedureParamDirection_Out
)

type ProcedureResolvedTable added in v0.9.0

type ProcedureResolvedTable struct {
	ResolvedTable *ResolvedTable
}

ProcedureResolvedTable represents a resolved SQL Table inside of a stored procedure. These are initially resolved to verify that they exist, and are then reloaded when another statement accesses its data. Some integrators return a snapshot of a table during the analysis step as an internal optimization, which is incompatible with stored procedures as they require the latest data at each statement.

func NewProcedureResolvedTable added in v0.9.0

func NewProcedureResolvedTable(rt *ResolvedTable) *ProcedureResolvedTable

NewProcedureResolvedTable returns a *ProcedureResolvedTable.

func (*ProcedureResolvedTable) Children added in v0.9.0

func (t *ProcedureResolvedTable) Children() []sql.Node

Children implements the sql.Node interface.

func (*ProcedureResolvedTable) DebugString added in v0.9.0

func (t *ProcedureResolvedTable) DebugString() string

DebugString implements the sql.DebugStringer interface.

func (*ProcedureResolvedTable) Name added in v0.9.0

func (t *ProcedureResolvedTable) Name() string

Name implements the sql.Table interface.

func (*ProcedureResolvedTable) PartitionRows added in v0.9.0

func (t *ProcedureResolvedTable) PartitionRows(ctx *sql.Context, partition sql.Partition) (sql.RowIter, error)

PartitionRows implements the sql.Table interface.

func (*ProcedureResolvedTable) Partitions added in v0.9.0

func (t *ProcedureResolvedTable) Partitions(ctx *sql.Context) (sql.PartitionIter, error)

Partitions implements the sql.Table interface.

func (*ProcedureResolvedTable) Resolved added in v0.9.0

func (t *ProcedureResolvedTable) Resolved() bool

Resolved implements the sql.Node interface.

func (*ProcedureResolvedTable) RowIter added in v0.9.0

func (t *ProcedureResolvedTable) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*ProcedureResolvedTable) Schema added in v0.9.0

func (t *ProcedureResolvedTable) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*ProcedureResolvedTable) String added in v0.9.0

func (t *ProcedureResolvedTable) String() string

String implements the sql.Node interface.

func (*ProcedureResolvedTable) Underlying added in v0.9.0

func (t *ProcedureResolvedTable) Underlying() sql.Table

Underlying implements the sql.TableWrapper interface.

func (*ProcedureResolvedTable) WithChildren added in v0.9.0

func (t *ProcedureResolvedTable) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the sql.Node interface.

type ProcedureSecurityContext added in v0.9.0

type ProcedureSecurityContext byte

ProcedureSecurityContext determines whether the stored procedure is executed using the privileges of the definer or the invoker.

const (
	// ProcedureSecurityContext_Definer uses the definer's security context.
	ProcedureSecurityContext_Definer ProcedureSecurityContext = iota
	// ProcedureSecurityContext_Invoker uses the invoker's security context.
	ProcedureSecurityContext_Invoker
)

func (ProcedureSecurityContext) String added in v0.9.0

func (pst ProcedureSecurityContext) String() string

String returns the original SQL representation.

type ProcessIndexableTable

type ProcessIndexableTable struct {
	sql.DriverIndexableTable
	OnPartitionDone  NamedNotifyFunc
	OnPartitionStart NamedNotifyFunc
	OnRowNext        NamedNotifyFunc
}

ProcessIndexableTable is a wrapper for sql.Tables inside a query process that support indexing. It notifies the process manager about the status of a query when a partition is processed.

func NewProcessIndexableTable

func NewProcessIndexableTable(t sql.DriverIndexableTable, onPartitionDone, onPartitionStart, OnRowNext NamedNotifyFunc) *ProcessIndexableTable

NewProcessIndexableTable returns a new ProcessIndexableTable.

func (*ProcessIndexableTable) DebugString added in v0.9.0

func (t *ProcessIndexableTable) DebugString() string

func (*ProcessIndexableTable) IndexKeyValues

func (t *ProcessIndexableTable) IndexKeyValues(
	ctx *sql.Context,
	columns []string,
) (sql.PartitionIndexKeyValueIter, error)

IndexKeyValues implements the sql.IndexableTable interface.

func (*ProcessIndexableTable) PartitionRows

func (t *ProcessIndexableTable) PartitionRows(ctx *sql.Context, p sql.Partition) (sql.RowIter, error)

PartitionRows implements the sql.Table interface.

func (*ProcessIndexableTable) Underlying

func (t *ProcessIndexableTable) Underlying() sql.Table

Underlying implements sql.TableWrapper interface.

type ProcessTable

type ProcessTable struct {
	sql.Table
	OnPartitionDone  NamedNotifyFunc
	OnPartitionStart NamedNotifyFunc
	OnRowNext        NamedNotifyFunc
}

ProcessTable is a wrapper for sql.Tables inside a query process. It notifies the process manager about the status of a query when a partition is processed.

func NewProcessTable

func NewProcessTable(t sql.Table, onPartitionDone, onPartitionStart, OnRowNext NamedNotifyFunc) *ProcessTable

NewProcessTable returns a new ProcessTable.

func (*ProcessTable) PartitionRows

func (t *ProcessTable) PartitionRows(ctx *sql.Context, p sql.Partition) (sql.RowIter, error)

PartitionRows implements the sql.Table interface.

func (*ProcessTable) Underlying

func (t *ProcessTable) Underlying() sql.Table

Underlying implements sql.TableWrapper interface.

type Project

type Project struct {
	UnaryNode
	// Expression projected.
	Projections []sql.Expression
}

Project is a projection of certain expression from the children node.

func NewProject

func NewProject(expressions []sql.Expression, child sql.Node) *Project

NewProject creates a new projection.

func (*Project) DebugString

func (p *Project) DebugString() string

func (*Project) Expressions

func (p *Project) Expressions() []sql.Expression

Expressions implements the Expressioner interface.

func (*Project) Resolved

func (p *Project) Resolved() bool

Resolved implements the Resolvable interface.

func (*Project) RowIter

func (p *Project) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (*Project) Schema

func (p *Project) Schema() sql.Schema

Schema implements the Node interface.

func (*Project) String

func (p *Project) String() string

func (*Project) WithChildren

func (p *Project) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (*Project) WithExpressions

func (p *Project) WithExpressions(exprs ...sql.Expression) (sql.Node, error)

WithExpressions implements the Expressioner interface.

type QueryProcess

type QueryProcess struct {
	UnaryNode
	Notify NotifyFunc
}

QueryProcess represents a running query process node. It will use a callback to notify when it has finished running.

func NewQueryProcess

func NewQueryProcess(node sql.Node, notify NotifyFunc) *QueryProcess

NewQueryProcess creates a new QueryProcess node.

func (*QueryProcess) DebugString

func (p *QueryProcess) DebugString() string

func (*QueryProcess) RowIter

func (p *QueryProcess) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*QueryProcess) String

func (p *QueryProcess) String() string

func (*QueryProcess) WithChildren

func (p *QueryProcess) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

type ReleaseSavepoint added in v0.10.0

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

func NewReleaseSavepoint added in v0.10.0

func NewReleaseSavepoint(db sql.UnresolvedDatabase, name string) *ReleaseSavepoint

NewReleaseSavepoint creates a new ReleaseSavepoint node.

func (*ReleaseSavepoint) Children added in v0.10.0

func (*ReleaseSavepoint) Children() []sql.Node

Children implements the sql.Node interface.

func (*ReleaseSavepoint) Database added in v0.10.0

func (r *ReleaseSavepoint) Database() sql.Database

func (*ReleaseSavepoint) Resolved added in v0.10.0

func (r *ReleaseSavepoint) Resolved() bool

Resolved implements the sql.Node interface.

func (*ReleaseSavepoint) RowIter added in v0.10.0

func (r *ReleaseSavepoint) RowIter(ctx *sql.Context, _ sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*ReleaseSavepoint) Schema added in v0.10.0

func (*ReleaseSavepoint) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*ReleaseSavepoint) String added in v0.10.0

func (r *ReleaseSavepoint) String() string

func (*ReleaseSavepoint) WithChildren added in v0.10.0

func (r *ReleaseSavepoint) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (ReleaseSavepoint) WithDatabase added in v0.10.0

func (r ReleaseSavepoint) WithDatabase(database sql.Database) (sql.Node, error)

type RenameColumn

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

func NewRenameColumn

func NewRenameColumn(db sql.Database, tableName string, columnName string, newColumnName string) *RenameColumn

func (*RenameColumn) Children

func (c *RenameColumn) Children() []sql.Node

Children implements the Node interface.

func (*RenameColumn) Database

func (c *RenameColumn) Database() sql.Database

Database implements the sql.Databaser interface.

func (*RenameColumn) Resolved

func (c *RenameColumn) Resolved() bool

Resolved implements the Resolvable interface.

func (*RenameColumn) RowIter

func (r *RenameColumn) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

func (*RenameColumn) Schema

func (*RenameColumn) Schema() sql.Schema

Schema implements the Node interface.

func (*RenameColumn) String

func (r *RenameColumn) String() string

func (*RenameColumn) WithChildren

func (r *RenameColumn) WithChildren(children ...sql.Node) (sql.Node, error)

func (*RenameColumn) WithDatabase

func (r *RenameColumn) WithDatabase(db sql.Database) (sql.Node, error)

type RenameTable

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

func NewRenameTable

func NewRenameTable(db sql.Database, oldNames, newNames []string) *RenameTable

NewRenameTable creates a new RenameTable node

func (*RenameTable) Children

func (c *RenameTable) Children() []sql.Node

Children implements the Node interface.

func (*RenameTable) Database

func (c *RenameTable) Database() sql.Database

Database implements the sql.Databaser interface.

func (*RenameTable) Resolved

func (c *RenameTable) Resolved() bool

Resolved implements the Resolvable interface.

func (*RenameTable) RowIter

func (r *RenameTable) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

func (*RenameTable) Schema

func (*RenameTable) Schema() sql.Schema

Schema implements the Node interface.

func (*RenameTable) String

func (r *RenameTable) String() string

func (*RenameTable) WithChildren

func (r *RenameTable) WithChildren(children ...sql.Node) (sql.Node, error)

func (*RenameTable) WithDatabase

func (r *RenameTable) WithDatabase(db sql.Database) (sql.Node, error)

type ResolvedTable

type ResolvedTable struct {
	sql.Table
	Database sql.Database
	AsOf     interface{}
}

ResolvedTable represents a resolved SQL Table.

func NewResolvedTable

func NewResolvedTable(table sql.Table, db sql.Database, asOf interface{}) *ResolvedTable

NewResolvedTable creates a new instance of ResolvedTable.

func (*ResolvedTable) Children

func (*ResolvedTable) Children() []sql.Node

Children implements the Node interface.

func (*ResolvedTable) DebugString

func (t *ResolvedTable) DebugString() string

func (*ResolvedTable) Resolved

func (*ResolvedTable) Resolved() bool

Resolved implements the Resolvable interface.

func (*ResolvedTable) RowIter

func (t *ResolvedTable) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the RowIter interface.

func (*ResolvedTable) String

func (t *ResolvedTable) String() string

func (*ResolvedTable) WithChildren

func (t *ResolvedTable) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (*ResolvedTable) WithTable added in v0.9.0

func (t *ResolvedTable) WithTable(table sql.Table) (*ResolvedTable, error)

WithTable returns this Node with the given table. The new table should have the same name as the previous table.

type RightJoin

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

RightJoin is a left join between two tables.

func NewRightJoin

func NewRightJoin(left, right sql.Node, cond sql.Expression) *RightJoin

NewRightJoin creates a new right join node from two tables.

func (RightJoin) Comment added in v0.9.0

func (j RightJoin) Comment() string

Comment implements sql.CommentedNode

func (*RightJoin) DebugString

func (j *RightJoin) DebugString() string

func (RightJoin) Expressions

func (j RightJoin) Expressions() []sql.Expression

Expressions implements sql.Expression

func (RightJoin) JoinCond

func (j RightJoin) JoinCond() sql.Expression

func (*RightJoin) JoinType

func (j *RightJoin) JoinType() JoinType

func (*RightJoin) Resolved

func (j *RightJoin) Resolved() bool

Resolved implements the Resolvable interface.

func (*RightJoin) RowIter

func (j *RightJoin) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (*RightJoin) Schema

func (j *RightJoin) Schema() sql.Schema

Schema implements the Node interface.

func (*RightJoin) String

func (j *RightJoin) String() string

func (*RightJoin) WithChildren

func (j *RightJoin) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (*RightJoin) WithComment added in v0.9.0

func (j *RightJoin) WithComment(comment string) sql.Node

WithComment implements sql.CommentedNode

func (*RightJoin) WithExpressions

func (j *RightJoin) WithExpressions(exprs ...sql.Expression) (sql.Node, error)

WithExpressions implements the Expressioner interface.

func (RightJoin) WithMultipassMode added in v0.10.0

func (j RightJoin) WithMultipassMode() JoinNode

func (*RightJoin) WithScopeLen added in v0.9.0

func (j *RightJoin) WithScopeLen(i int) JoinNode

type Rollback

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

Rollback undoes the changes performed in the current transaction. For compatibility, databases that don't implement sql.TransactionDatabase treat this as a no-op.

func NewRollback

func NewRollback(db sql.UnresolvedDatabase) *Rollback

NewRollback creates a new Rollback node.

func (*Rollback) Children

func (*Rollback) Children() []sql.Node

Children implements the sql.Node interface.

func (*Rollback) Database added in v0.10.0

func (r *Rollback) Database() sql.Database

func (*Rollback) Resolved

func (r *Rollback) Resolved() bool

Resolved implements the sql.Node interface.

func (*Rollback) RowIter

func (r *Rollback) RowIter(ctx *sql.Context, _ sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*Rollback) Schema

func (*Rollback) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*Rollback) String

func (*Rollback) String() string

func (*Rollback) WithChildren

func (r *Rollback) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (Rollback) WithDatabase added in v0.10.0

func (r Rollback) WithDatabase(database sql.Database) (sql.Node, error)

type RollbackSavepoint added in v0.10.0

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

func NewRollbackSavepoint added in v0.10.0

func NewRollbackSavepoint(db sql.UnresolvedDatabase, name string) *RollbackSavepoint

NewRollbackSavepoint creates a new RollbackSavepoint node.

func (*RollbackSavepoint) Children added in v0.10.0

func (*RollbackSavepoint) Children() []sql.Node

Children implements the sql.Node interface.

func (*RollbackSavepoint) Database added in v0.10.0

func (r *RollbackSavepoint) Database() sql.Database

func (*RollbackSavepoint) Resolved added in v0.10.0

func (r *RollbackSavepoint) Resolved() bool

Resolved implements the sql.Node interface.

func (*RollbackSavepoint) RowIter added in v0.10.0

func (r *RollbackSavepoint) RowIter(ctx *sql.Context, _ sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*RollbackSavepoint) Schema added in v0.10.0

func (*RollbackSavepoint) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*RollbackSavepoint) String added in v0.10.0

func (r *RollbackSavepoint) String() string

func (*RollbackSavepoint) WithChildren added in v0.10.0

func (r *RollbackSavepoint) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (RollbackSavepoint) WithDatabase added in v0.10.0

func (r RollbackSavepoint) WithDatabase(database sql.Database) (sql.Node, error)

type RowUpdateAccumulator

type RowUpdateAccumulator struct {
	UnaryNode
	RowUpdateType
}

RowUpdateAccumulator wraps other nodes that update tables, and returns their results as OKResults with the appropriate fields set.

func NewRowUpdateAccumulator

func NewRowUpdateAccumulator(n sql.Node, updateType RowUpdateType) *RowUpdateAccumulator

NewRowUpdateResult returns a new RowUpdateResult with the given node to wrap.

func (RowUpdateAccumulator) DebugString

func (r RowUpdateAccumulator) DebugString() string

func (RowUpdateAccumulator) RowIter

func (r RowUpdateAccumulator) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

func (RowUpdateAccumulator) Schema

func (r RowUpdateAccumulator) Schema() sql.Schema

func (RowUpdateAccumulator) String

func (r RowUpdateAccumulator) String() string

func (RowUpdateAccumulator) WithChildren

func (r RowUpdateAccumulator) WithChildren(children ...sql.Node) (sql.Node, error)

type RowUpdateType

type RowUpdateType int
const (
	UpdateTypeInsert RowUpdateType = iota
	UpdateTypeReplace
	UpdateTypeDuplicateKeyUpdate
	UpdateTypeUpdate
	UpdateTypeDelete
	UpdateTypeJoinUpdate
)

type Set

type Set struct {
	Exprs []sql.Expression
}

Set represents a set statement. This can be variables, but in some instances can also refer to row values.

func NewSet

func NewSet(vars []sql.Expression) *Set

NewSet creates a new Set node.

func (*Set) Children

func (s *Set) Children() []sql.Node

Children implements the sql.Node interface.

func (*Set) DebugString

func (s *Set) DebugString() string

func (*Set) Expressions

func (s *Set) Expressions() []sql.Expression

Expressions implements the sql.Expressioner interface.

func (*Set) Resolved

func (s *Set) Resolved() bool

Resolved implements the sql.Node interface.

func (*Set) RowIter

func (s *Set) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*Set) Schema

func (s *Set) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*Set) String

func (s *Set) String() string

func (*Set) WithChildren

func (s *Set) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the sql.Node interface.

func (*Set) WithExpressions

func (s *Set) WithExpressions(exprs ...sql.Expression) (sql.Node, error)

WithExpressions implements the sql.Expressioner interface.

type ShowCharset added in v0.9.0

type ShowCharset struct {
	CharacterSetTable sql.Node
}

func NewShowCharset added in v0.9.0

func NewShowCharset() *ShowCharset

NewShowCharset returns a new ShowCharset reference.

func (*ShowCharset) Children added in v0.9.0

func (sc *ShowCharset) Children() []sql.Node

func (*ShowCharset) Resolved added in v0.9.0

func (sc *ShowCharset) Resolved() bool

Resolved implements sql.Node interface. The function always returns true.

func (*ShowCharset) RowIter added in v0.9.0

func (sc *ShowCharset) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

func (*ShowCharset) Schema added in v0.9.0

func (sc *ShowCharset) Schema() sql.Schema

Note how this Schema differs in order from the information_schema.character_sets table.

func (*ShowCharset) String added in v0.9.0

func (sc *ShowCharset) String() string

func (*ShowCharset) WithChildren added in v0.9.0

func (sc *ShowCharset) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

type ShowColumns

type ShowColumns struct {
	UnaryNode
	Full    bool
	Indexes []sql.Index
}

ShowColumns shows the columns details of a table.

func NewShowColumns

func NewShowColumns(full bool, child sql.Node) *ShowColumns

NewShowColumns creates a new ShowColumns node.

func (*ShowColumns) RowIter

func (s *ShowColumns) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter creates a new ShowColumns node.

func (*ShowColumns) Schema

func (s *ShowColumns) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*ShowColumns) String

func (s *ShowColumns) String() string

func (*ShowColumns) WithChildren

func (s *ShowColumns) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

type ShowCreateDatabase

type ShowCreateDatabase struct {
	IfNotExists bool
	// contains filtered or unexported fields
}

ShowCreateDatabase returns the SQL for creating a database.

func NewShowCreateDatabase

func NewShowCreateDatabase(db sql.Database, ifNotExists bool) *ShowCreateDatabase

NewShowCreateDatabase creates a new ShowCreateDatabase node.

func (*ShowCreateDatabase) Children

func (s *ShowCreateDatabase) Children() []sql.Node

Children implements the sql.Node interface.

func (*ShowCreateDatabase) Database

func (s *ShowCreateDatabase) Database() sql.Database

Database implements the sql.Databaser interface.

func (*ShowCreateDatabase) Resolved

func (s *ShowCreateDatabase) Resolved() bool

Resolved implements the sql.Node interface.

func (*ShowCreateDatabase) RowIter

func (s *ShowCreateDatabase) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*ShowCreateDatabase) Schema

func (s *ShowCreateDatabase) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*ShowCreateDatabase) String

func (s *ShowCreateDatabase) String() string

func (*ShowCreateDatabase) WithChildren

func (s *ShowCreateDatabase) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (*ShowCreateDatabase) WithDatabase

func (s *ShowCreateDatabase) WithDatabase(db sql.Database) (sql.Node, error)

WithDatabase implements the sql.Databaser interface.

type ShowCreateTable

type ShowCreateTable struct {
	*UnaryNode
	IsView  bool
	Indexes []sql.Index
	Checks  sql.CheckConstraints
}

ShowCreateTable is a node that shows the CREATE TABLE statement for a table.

func (*ShowCreateTable) Resolved

func (n *ShowCreateTable) Resolved() bool

Resolved implements the Resolvable interface.

func (*ShowCreateTable) RowIter

func (n *ShowCreateTable) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface

func (*ShowCreateTable) Schema

func (n *ShowCreateTable) Schema() sql.Schema

Schema implements the Node interface.

func (*ShowCreateTable) String

func (n *ShowCreateTable) String() string

String implements the fmt.Stringer interface.

func (*ShowCreateTable) WithChildren

func (n *ShowCreateTable) WithChildren(children ...sql.Node) (sql.Node, error)

type ShowCreateTrigger

type ShowCreateTrigger struct {
	TriggerName string
	// contains filtered or unexported fields
}

func NewShowCreateTrigger

func NewShowCreateTrigger(db sql.Database, trigger string) *ShowCreateTrigger

NewShowCreateTrigger creates a new ShowCreateTrigger node for SHOW CREATE TRIGGER statements.

func (*ShowCreateTrigger) Children

func (s *ShowCreateTrigger) Children() []sql.Node

Children implements the sql.Node interface.

func (*ShowCreateTrigger) Database

func (s *ShowCreateTrigger) Database() sql.Database

Database implements the sql.Databaser interface.

func (*ShowCreateTrigger) Resolved

func (s *ShowCreateTrigger) Resolved() bool

Resolved implements the sql.Node interface.

func (*ShowCreateTrigger) RowIter

func (s *ShowCreateTrigger) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*ShowCreateTrigger) Schema

func (s *ShowCreateTrigger) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*ShowCreateTrigger) String

func (s *ShowCreateTrigger) String() string

String implements the sql.Node interface.

func (*ShowCreateTrigger) WithChildren

func (s *ShowCreateTrigger) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the sql.Node interface.

func (*ShowCreateTrigger) WithDatabase

func (s *ShowCreateTrigger) WithDatabase(db sql.Database) (sql.Node, error)

WithDatabase implements the sql.Databaser interface.

type ShowDatabases

type ShowDatabases struct {
	Catalog sql.Catalog
}

ShowDatabases is a node that shows the databases.

func NewShowDatabases

func NewShowDatabases() *ShowDatabases

NewShowDatabases creates a new show databases node.

func (*ShowDatabases) Children

func (*ShowDatabases) Children() []sql.Node

Children implements the Node interface.

func (*ShowDatabases) Resolved

func (p *ShowDatabases) Resolved() bool

Resolved implements the Resolvable interface.

func (*ShowDatabases) RowIter

func (p *ShowDatabases) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (*ShowDatabases) Schema

func (*ShowDatabases) Schema() sql.Schema

Schema implements the Node interface.

func (ShowDatabases) String

func (p ShowDatabases) String() string

func (*ShowDatabases) WithChildren

func (p *ShowDatabases) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

type ShowGrants added in v0.9.0

type ShowGrants struct{}

ShowGrants shows the columns details of a table.

func NewShowGrants added in v0.9.0

func NewShowGrants() *ShowGrants

NewShowGrants creates a new ShowGrants node.

func (*ShowGrants) Children added in v0.9.0

func (s *ShowGrants) Children() []sql.Node

func (*ShowGrants) Resolved added in v0.9.0

func (s *ShowGrants) Resolved() bool

func (*ShowGrants) RowIter added in v0.9.0

func (s *ShowGrants) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter creates a new ShowGrants node.

func (*ShowGrants) Schema added in v0.9.0

func (s *ShowGrants) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*ShowGrants) String added in v0.9.0

func (s *ShowGrants) String() string

func (*ShowGrants) WithChildren added in v0.9.0

func (s *ShowGrants) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

type ShowIndexes

type ShowIndexes struct {
	UnaryNode
	IndexesToShow []sql.Index
}

ShowIndexes is a node that shows the indexes on a table.

func (*ShowIndexes) RowIter

func (n *ShowIndexes) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (*ShowIndexes) Schema

func (n *ShowIndexes) Schema() sql.Schema

Schema implements the Node interface.

func (*ShowIndexes) String

func (n *ShowIndexes) String() string

String implements the fmt.Stringer interface.

func (*ShowIndexes) WithChildren

func (n *ShowIndexes) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

type ShowProcedureStatus added in v0.9.0

type ShowProcedureStatus struct {
	Procedures []*Procedure
	// contains filtered or unexported fields
}

func NewShowProcedureStatus added in v0.9.0

func NewShowProcedureStatus(db sql.Database) *ShowProcedureStatus

NewShowProcedureStatus creates a new *ShowProcedureStatus node.

func (*ShowProcedureStatus) Children added in v0.9.0

func (s *ShowProcedureStatus) Children() []sql.Node

Children implements the sql.Node interface.

func (*ShowProcedureStatus) Database added in v0.9.0

func (s *ShowProcedureStatus) Database() sql.Database

Database implements the sql.Databaser interface.

func (*ShowProcedureStatus) Resolved added in v0.9.0

func (s *ShowProcedureStatus) Resolved() bool

Resolved implements the sql.Node interface.

func (*ShowProcedureStatus) RowIter added in v0.9.0

func (s *ShowProcedureStatus) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*ShowProcedureStatus) Schema added in v0.9.0

func (s *ShowProcedureStatus) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*ShowProcedureStatus) String added in v0.9.0

func (s *ShowProcedureStatus) String() string

String implements the sql.Node interface.

func (*ShowProcedureStatus) WithChildren added in v0.9.0

func (s *ShowProcedureStatus) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the sql.Node interface.

func (*ShowProcedureStatus) WithDatabase added in v0.9.0

func (s *ShowProcedureStatus) WithDatabase(db sql.Database) (sql.Node, error)

WithDatabase implements the sql.Databaser interface.

type ShowProcessList

type ShowProcessList struct {
	Database string
}

ShowProcessList shows a list of all current running processes.

func NewShowProcessList

func NewShowProcessList() *ShowProcessList

NewShowProcessList creates a new ProcessList node.

func (*ShowProcessList) Children

func (p *ShowProcessList) Children() []sql.Node

Children implements the Node interface.

func (*ShowProcessList) Resolved

func (p *ShowProcessList) Resolved() bool

Resolved implements the Node interface.

func (*ShowProcessList) RowIter

func (p *ShowProcessList) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (*ShowProcessList) Schema

func (p *ShowProcessList) Schema() sql.Schema

Schema implements the Node interface.

func (*ShowProcessList) String

func (p *ShowProcessList) String() string

func (*ShowProcessList) WithChildren

func (p *ShowProcessList) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

type ShowStatus added in v0.11.0

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

ShowStatus implements the SHOW STATUS MySQL command. TODO: This is just a stub implementation that returns an empty set. The actual functionality needs to be implemented in the future.

func NewShowStatus added in v0.11.0

func NewShowStatus(modifier ShowStatusModifier) *ShowStatus

NewShowStatus returns a new ShowStatus reference.

func (*ShowStatus) Children added in v0.11.0

func (s *ShowStatus) Children() []sql.Node

Children implements sql.Node interface.

func (*ShowStatus) Resolved added in v0.11.0

func (s *ShowStatus) Resolved() bool

Resolved implements sql.Node interface.

func (*ShowStatus) RowIter added in v0.11.0

func (s *ShowStatus) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements sql.Node interface.

func (*ShowStatus) Schema added in v0.11.0

func (s *ShowStatus) Schema() sql.Schema

Schema implements sql.Node interface.

func (*ShowStatus) String added in v0.11.0

func (s *ShowStatus) String() string

String implements sql.Node interface.

func (*ShowStatus) WithChildren added in v0.11.0

func (s *ShowStatus) WithChildren(node ...sql.Node) (sql.Node, error)

WithChildren implements sql.Node interface.

type ShowStatusModifier added in v0.11.0

type ShowStatusModifier byte
const (
	ShowStatusModifier_Session ShowStatusModifier = iota
	ShowStatusModifier_Global
)

type ShowTableStatus

type ShowTableStatus struct {
	Catalog sql.Catalog
	// contains filtered or unexported fields
}

ShowTableStatus returns the status of the tables in a database.

func NewShowTableStatus

func NewShowTableStatus(db sql.Database) *ShowTableStatus

NewShowTableStatus creates a new ShowTableStatus node.

func (*ShowTableStatus) Children

func (s *ShowTableStatus) Children() []sql.Node

Children implements the sql.Node interface.

func (*ShowTableStatus) Database added in v0.9.0

func (s *ShowTableStatus) Database() sql.Database

func (*ShowTableStatus) Resolved

func (s *ShowTableStatus) Resolved() bool

Resolved implements the sql.Node interface.

func (*ShowTableStatus) RowIter

func (s *ShowTableStatus) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*ShowTableStatus) Schema

func (s *ShowTableStatus) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*ShowTableStatus) String

func (s *ShowTableStatus) String() string

func (*ShowTableStatus) WithChildren

func (s *ShowTableStatus) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (*ShowTableStatus) WithDatabase added in v0.9.0

func (s *ShowTableStatus) WithDatabase(db sql.Database) (sql.Node, error)

type ShowTables

type ShowTables struct {
	Full bool
	AsOf sql.Expression
	// contains filtered or unexported fields
}

ShowTables is a node that shows the database tables.

func NewShowTables

func NewShowTables(database sql.Database, full bool, asOf sql.Expression) *ShowTables

NewShowTables creates a new show tables node given a database.

func (*ShowTables) Children

func (*ShowTables) Children() []sql.Node

Children implements the Node interface.

func (*ShowTables) Database

func (p *ShowTables) Database() sql.Database

Database implements the sql.Databaser interface.

func (*ShowTables) Expressions

func (p *ShowTables) Expressions() []sql.Expression

Expressions implements sql.Expressioner

func (*ShowTables) Resolved

func (p *ShowTables) Resolved() bool

Resolved implements the Resolvable interface.

func (*ShowTables) RowIter

func (p *ShowTables) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (*ShowTables) Schema

func (p *ShowTables) Schema() sql.Schema

Schema implements the Node interface.

func (ShowTables) String

func (p ShowTables) String() string

func (*ShowTables) WithChildren

func (p *ShowTables) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (*ShowTables) WithDatabase

func (p *ShowTables) WithDatabase(db sql.Database) (sql.Node, error)

WithDatabase implements the sql.Databaser interface.

func (*ShowTables) WithExpressions

func (p *ShowTables) WithExpressions(exprs ...sql.Expression) (sql.Node, error)

WithExpressions implements sql.Expressioner

type ShowTriggers

type ShowTriggers struct {
	Triggers []*CreateTrigger
	// contains filtered or unexported fields
}

func NewShowTriggers

func NewShowTriggers(db sql.Database) *ShowTriggers

NewShowCreateTrigger creates a new ShowCreateTrigger node for SHOW TRIGGER statements.

func (*ShowTriggers) Children

func (s *ShowTriggers) Children() []sql.Node

Children implements the sql.Node interface.

func (*ShowTriggers) Database

func (s *ShowTriggers) Database() sql.Database

Database implements the sql.Databaser interface.

func (*ShowTriggers) Resolved

func (s *ShowTriggers) Resolved() bool

Resolved implements the sql.Node interface.

func (*ShowTriggers) RowIter

func (s *ShowTriggers) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*ShowTriggers) Schema

func (s *ShowTriggers) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*ShowTriggers) String

func (s *ShowTriggers) String() string

String implements the sql.Node interface.

func (*ShowTriggers) WithChildren

func (s *ShowTriggers) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the sql.Node interface.

func (*ShowTriggers) WithDatabase

func (s *ShowTriggers) WithDatabase(db sql.Database) (sql.Node, error)

WithDatabase implements the sql.Databaser interface.

type ShowVariables

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

ShowVariables is a node that shows the global and session variables TODO: implement the GLOBAL and SESSION distinction

func NewShowVariables

func NewShowVariables(like string) *ShowVariables

NewShowVariables returns a new ShowVariables reference. like is a "like pattern". If like is an empty string it will return all variables.

func (*ShowVariables) Children

func (*ShowVariables) Children() []sql.Node

Children implements sql.Node interface. The function always returns nil.

func (*ShowVariables) Resolved

func (sv *ShowVariables) Resolved() bool

Resolved implements sql.Node interface. The function always returns true.

func (*ShowVariables) RowIter

func (sv *ShowVariables) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface. The function returns an iterator for filtered variables (based on like pattern)

func (*ShowVariables) Schema

func (*ShowVariables) Schema() sql.Schema

Schema returns a new Schema reference for "SHOW VARIABLES" query.

func (*ShowVariables) String

func (sv *ShowVariables) String() string

String implements the fmt.Stringer interface.

func (*ShowVariables) WithChildren

func (sv *ShowVariables) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

type ShowWarnings

type ShowWarnings []*sql.Warning

ShowWarnings is a node that shows the session warnings

func (ShowWarnings) Children

func (ShowWarnings) Children() []sql.Node

Children implements sql.Node interface. The function always returns nil.

func (ShowWarnings) Resolved

func (ShowWarnings) Resolved() bool

Resolved implements sql.Node interface. The function always returns true.

func (ShowWarnings) RowIter

func (sw ShowWarnings) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface. The function returns an iterator for warnings (considering offset and counter)

func (ShowWarnings) Schema

func (ShowWarnings) Schema() sql.Schema

Schema returns a new Schema reference for "SHOW VARIABLES" query.

func (ShowWarnings) String

func (ShowWarnings) String() string

String implements the fmt.Stringer interface.

func (ShowWarnings) WithChildren

func (sw ShowWarnings) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

type Signal added in v0.9.0

type Signal struct {
	SqlStateValue string // Will always be a string with length 5
	Info          map[SignalConditionItemName]SignalInfo
}

Signal represents the SIGNAL statement with a set SQLSTATE.

func NewSignal added in v0.9.0

func NewSignal(sqlstate string, info map[SignalConditionItemName]SignalInfo) *Signal

NewSignal returns a *Signal node.

func (*Signal) Children added in v0.9.0

func (s *Signal) Children() []sql.Node

Children implements the sql.Node interface.

func (*Signal) Resolved added in v0.9.0

func (s *Signal) Resolved() bool

Resolved implements the sql.Node interface.

func (*Signal) RowIter added in v0.9.0

func (s *Signal) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*Signal) Schema added in v0.9.0

func (s *Signal) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*Signal) String added in v0.9.0

func (s *Signal) String() string

String implements the sql.Node interface.

func (*Signal) WithChildren added in v0.9.0

func (s *Signal) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the sql.Node interface.

type SignalConditionItemName added in v0.9.0

type SignalConditionItemName string

SignalConditionItemName represents the item name for the set conditions of a SIGNAL statement.

const (
	SignalConditionItemName_ClassOrigin       SignalConditionItemName = "class_origin"
	SignalConditionItemName_SubclassOrigin    SignalConditionItemName = "subclass_origin"
	SignalConditionItemName_MessageText       SignalConditionItemName = "message_text"
	SignalConditionItemName_MysqlErrno        SignalConditionItemName = "mysql_errno"
	SignalConditionItemName_ConstraintCatalog SignalConditionItemName = "constraint_catalog"
	SignalConditionItemName_ConstraintSchema  SignalConditionItemName = "constraint_schema"
	SignalConditionItemName_ConstraintName    SignalConditionItemName = "constraint_name"
	SignalConditionItemName_CatalogName       SignalConditionItemName = "catalog_name"
	SignalConditionItemName_SchemaName        SignalConditionItemName = "schema_name"
	SignalConditionItemName_TableName         SignalConditionItemName = "table_name"
	SignalConditionItemName_ColumnName        SignalConditionItemName = "column_name"
	SignalConditionItemName_CursorName        SignalConditionItemName = "cursor_name"
)

type SignalInfo added in v0.9.0

type SignalInfo struct {
	ConditionItemName SignalConditionItemName
	IntValue          int64
	StrValue          string
}

SignalInfo represents a piece of information for a SIGNAL statement.

func (SignalInfo) String added in v0.9.0

func (s SignalInfo) String() string

type SignalName added in v0.9.0

type SignalName struct {
	Signal *Signal
	Name   string
}

SignalName represents the SIGNAL statement with a condition name.

func NewSignalName added in v0.9.0

func NewSignalName(name string, info map[SignalConditionItemName]SignalInfo) *SignalName

NewSignalName returns a *SignalName node.

func (*SignalName) Children added in v0.9.0

func (s *SignalName) Children() []sql.Node

Children implements the sql.Node interface.

func (*SignalName) Resolved added in v0.9.0

func (s *SignalName) Resolved() bool

Resolved implements the sql.Node interface.

func (*SignalName) RowIter added in v0.9.0

func (s *SignalName) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*SignalName) Schema added in v0.9.0

func (s *SignalName) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*SignalName) String added in v0.9.0

func (s *SignalName) String() string

String implements the sql.Node interface.

func (*SignalName) WithChildren added in v0.9.0

func (s *SignalName) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the sql.Node interface.

type SingleDropView

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

func NewSingleDropView

func NewSingleDropView(
	database sql.Database,
	viewName string,
) *SingleDropView

NewSingleDropView creates a SingleDropView.

func (*SingleDropView) Children

func (dv *SingleDropView) Children() []sql.Node

Children implements the Node interface. It always returns nil.

func (*SingleDropView) Database

func (dv *SingleDropView) Database() sql.Database

Database implements the sql.Databaser interface. It returns the node's database.

func (*SingleDropView) Resolved

func (dv *SingleDropView) Resolved() bool

Resolved implements the Node interface. This node is resolved if and only if its database is resolved.

func (*SingleDropView) RowIter

func (dv *SingleDropView) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface. It always returns an empty iterator.

func (*SingleDropView) Schema

func (dv *SingleDropView) Schema() sql.Schema

Schema implements the Node interface. It always returns nil.

func (*SingleDropView) String

func (dv *SingleDropView) String() string

String implements the fmt.Stringer interface, using sql.TreePrinter to generate the string.

func (*SingleDropView) WithChildren

func (dv *SingleDropView) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface. It only succeeds if the length of the specified children equals 0.

func (*SingleDropView) WithDatabase

func (dv *SingleDropView) WithDatabase(database sql.Database) (sql.Node, error)

WithDatabase implements the sql.Databaser interface, and it returns a copy of this node with the specified database.

type Sort

type Sort struct {
	UnaryNode
	SortFields []sql.SortField
}

Sort is the sort node.

func NewSort

func NewSort(sortFields []sql.SortField, child sql.Node) *Sort

NewSort creates a new Sort node.

func (*Sort) DebugString

func (s *Sort) DebugString() string

func (*Sort) Expressions

func (s *Sort) Expressions() []sql.Expression

Expressions implements the Expressioner interface.

func (*Sort) Resolved

func (s *Sort) Resolved() bool

Resolved implements the Resolvable interface.

func (*Sort) RowIter

func (s *Sort) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (*Sort) String

func (s *Sort) String() string

func (*Sort) WithChildren

func (s *Sort) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (*Sort) WithExpressions

func (s *Sort) WithExpressions(exprs ...sql.Expression) (sql.Node, error)

WithExpressions implements the Expressioner interface.

type StartTransaction added in v0.10.0

type StartTransaction struct {
	UnaryNode // null in the case that this is an explicit StartTransaction statement, set to the wrapped statement node otherwise
	// contains filtered or unexported fields
}

StartTransaction explicitly starts a transaction. Transactions also start before any statement execution that doesn't have a transaction.

func NewStartTransaction added in v0.10.0

func NewStartTransaction(db sql.UnresolvedDatabase, transactionChar sql.TransactionCharacteristic) *StartTransaction

NewStartTransaction creates a new StartTransaction node.

func (*StartTransaction) Children added in v0.10.0

func (s *StartTransaction) Children() []sql.Node

func (*StartTransaction) Database added in v0.10.0

func (s *StartTransaction) Database() sql.Database

func (*StartTransaction) DebugString added in v0.10.0

func (s *StartTransaction) DebugString() string

func (*StartTransaction) Resolved added in v0.10.0

func (s *StartTransaction) Resolved() bool

Resolved implements the sql.Node interface.

func (*StartTransaction) RowIter added in v0.10.0

func (s *StartTransaction) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*StartTransaction) Schema added in v0.10.0

func (s *StartTransaction) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*StartTransaction) String added in v0.10.0

func (s *StartTransaction) String() string

func (StartTransaction) WithChildren added in v0.10.0

func (s StartTransaction) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (StartTransaction) WithDatabase added in v0.10.0

func (s StartTransaction) WithDatabase(database sql.Database) (sql.Node, error)

type StripRowNode added in v0.9.0

type StripRowNode struct {
	UnaryNode
	// contains filtered or unexported fields
}

func (*StripRowNode) DebugString added in v0.9.0

func (srn *StripRowNode) DebugString() string

func (*StripRowNode) RowIter added in v0.9.0

func (srn *StripRowNode) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

func (*StripRowNode) String added in v0.9.0

func (srn *StripRowNode) String() string

func (*StripRowNode) WithChildren added in v0.9.0

func (srn *StripRowNode) WithChildren(children ...sql.Node) (sql.Node, error)

type Subquery

type Subquery struct {
	// The subquery to execute for each row in the outer result set
	Query sql.Node
	// The original verbatim select statement for this subquery
	QueryString string
	// contains filtered or unexported fields
}

Subquery is as an expression whose value is derived by executing a subquery. It must be executed for every row in the outer result set. It's in the plan package instead of the expression package because it functions more like a plan Node than an expression.

func NewSubquery

func NewSubquery(node sql.Node, queryString string) *Subquery

NewSubquery returns a new subquery expression.

func (*Subquery) Children

func (s *Subquery) Children() []sql.Expression

Children implements the Expression interface.

func (*Subquery) DebugString

func (s *Subquery) DebugString() string

func (*Subquery) Dispose

func (s *Subquery) Dispose()

Dispose implements sql.Disposable

func (*Subquery) Eval

func (s *Subquery) Eval(ctx *sql.Context, row sql.Row) (interface{}, error)

Eval implements the Expression interface.

func (*Subquery) EvalMultiple

func (s *Subquery) EvalMultiple(ctx *sql.Context, row sql.Row) ([]interface{}, error)

EvalMultiple returns all rows returned by a subquery.

func (*Subquery) HasResultRow added in v0.11.0

func (s *Subquery) HasResultRow(ctx *sql.Context, row sql.Row) (bool, error)

HasResultRow returns whether the subquery has a result set > 0.

func (*Subquery) HashMultiple

func (s *Subquery) HashMultiple(ctx *sql.Context, row sql.Row) (sql.KeyValueCache, error)

HashMultiple returns all rows returned by a subquery, backed by a sql.KeyValueCache. Keys are constructed using the 64-bit hash of the values stored.

func (*Subquery) IsNonDeterministic

func (s *Subquery) IsNonDeterministic() bool

func (*Subquery) IsNullable

func (s *Subquery) IsNullable() bool

IsNullable implements the Expression interface.

func (*Subquery) Resolved

func (s *Subquery) Resolved() bool

Resolved implements the Expression interface.

func (*Subquery) String

func (s *Subquery) String() string

func (*Subquery) Type

func (s *Subquery) Type() sql.Type

Type implements the Expression interface.

func (*Subquery) WithCachedResults

func (s *Subquery) WithCachedResults() *Subquery

WithCachedResults returns the subquery with CanCacheResults set to true.

func (*Subquery) WithChildren

func (s *Subquery) WithChildren(children ...sql.Expression) (sql.Expression, error)

WithChildren implements the Expression interface.

func (*Subquery) WithQuery

func (s *Subquery) WithQuery(node sql.Node) *Subquery

WithQuery returns the subquery with the query node changed.

type SubqueryAlias

type SubqueryAlias struct {
	UnaryNode
	Columns []string

	TextDefinition string
	// contains filtered or unexported fields
}

SubqueryAlias is a node that gives a subquery a name.

func NewSubqueryAlias

func NewSubqueryAlias(name, textDefinition string, node sql.Node) *SubqueryAlias

NewSubqueryAlias creates a new SubqueryAlias node.

func (*SubqueryAlias) AsView

func (sq *SubqueryAlias) AsView() *sql.View

Returns the view wrapper for this subquery

func (SubqueryAlias) DebugString

func (sq SubqueryAlias) DebugString() string

func (*SubqueryAlias) Name

func (sq *SubqueryAlias) Name() string

Name implements the Table interface.

func (*SubqueryAlias) Opaque

func (sq *SubqueryAlias) Opaque() bool

Opaque implements the OpaqueNode interface.

func (*SubqueryAlias) RowIter

func (sq *SubqueryAlias) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (*SubqueryAlias) Schema

func (sq *SubqueryAlias) Schema() sql.Schema

Schema implements the Node interface.

func (SubqueryAlias) String

func (sq SubqueryAlias) String() string

func (*SubqueryAlias) WithChildren

func (sq *SubqueryAlias) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (SubqueryAlias) WithColumns added in v0.9.0

func (sq SubqueryAlias) WithColumns(columns []string) *SubqueryAlias

func (SubqueryAlias) WithName added in v0.9.0

func (sq SubqueryAlias) WithName(name string) *SubqueryAlias

type TableAlias

type TableAlias struct {
	*UnaryNode
	// contains filtered or unexported fields
}

TableAlias is a node that acts as a table with a given name.

func NewTableAlias

func NewTableAlias(name string, node sql.Node) *TableAlias

NewTableAlias returns a new Table alias node.

func (TableAlias) DebugString

func (t TableAlias) DebugString() string

func (*TableAlias) Name

func (t *TableAlias) Name() string

Name implements the Nameable interface.

func (*TableAlias) RowIter

func (t *TableAlias) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (*TableAlias) Schema

func (t *TableAlias) Schema() sql.Schema

Schema implements the Node interface. TableAlias alters the schema of its child element to rename the source of columns to the alias.

func (TableAlias) String

func (t TableAlias) String() string

func (*TableAlias) WithChildren

func (t *TableAlias) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (TableAlias) WithName added in v0.9.0

func (t TableAlias) WithName(name string) *TableAlias

type TableCopier added in v0.11.0

type TableCopier struct {
	sql.Node
	// contains filtered or unexported fields
}

TableCopier is a supporting node that allows for the optimization of copying tables. It should be used in two cases. 1) CREATE TABLE SELECT * 2) INSERT INTO SELECT * where the inserted table is empty. // TODO: Implement this optimization

func NewTableCopier added in v0.11.0

func NewTableCopier(db sql.Database, createTableNode sql.Node, source sql.Node, prop CopierProps) *TableCopier

func (*TableCopier) Children added in v0.11.0

func (tc *TableCopier) Children() []sql.Node

func (*TableCopier) Database added in v0.11.0

func (tc *TableCopier) Database() sql.Database

func (*TableCopier) Resolved added in v0.11.0

func (tc *TableCopier) Resolved() bool

func (*TableCopier) RowIter added in v0.11.0

func (tc *TableCopier) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

func (*TableCopier) Schema added in v0.11.0

func (tc *TableCopier) Schema() sql.Schema

func (*TableCopier) String added in v0.11.0

func (tc *TableCopier) String() string

func (*TableCopier) WithChildren added in v0.11.0

func (tc *TableCopier) WithChildren(...sql.Node) (sql.Node, error)

func (*TableCopier) WithDatabase added in v0.11.0

func (tc *TableCopier) WithDatabase(db sql.Database) (sql.Node, error)

type TableLock

type TableLock struct {
	Table sql.Node
	// Write if it's true, read if it's false.
	Write bool
}

TableLock is a read or write lock on a table.

type TableSpec added in v0.9.0

type TableSpec struct {
	Schema  sql.Schema
	FkDefs  []*sql.ForeignKeyConstraint
	ChDefs  []*sql.CheckConstraint
	IdxDefs []*IndexDefinition
}

TableSpec is a node describing the schema of a table.

func (*TableSpec) WithCheckConstraints added in v0.9.0

func (c *TableSpec) WithCheckConstraints(chDefs []*sql.CheckConstraint) *TableSpec

func (*TableSpec) WithForeignKeys added in v0.9.0

func (c *TableSpec) WithForeignKeys(fkDefs []*sql.ForeignKeyConstraint) *TableSpec

func (*TableSpec) WithIndices added in v0.9.0

func (c *TableSpec) WithIndices(idxDefs []*IndexDefinition) *TableSpec

func (*TableSpec) WithSchema added in v0.9.0

func (c *TableSpec) WithSchema(schema sql.Schema) *TableSpec

type TempTableOption added in v0.11.0

type TempTableOption bool
const (
	IsTempTable       TempTableOption = true
	IsTempTableAbsent TempTableOption = false
)

type TransformContext added in v0.11.0

type TransformContext struct {
	// Node is the currently visited node which will be transformed.
	Node sql.Node
	// Parent is the current parent of the transforming node.
	Parent sql.Node
	// ChildNum is the index of Node in Parent.Children().
	ChildNum int
	// SchemaPrefix is the concatenation of the Parent's SchemaPrefix with
	// child.Schema() for all child with an index < ChildNum in
	// Parent.Children(). For many Nodes, this represents the schema of the
	// |row| parameter that is going to be passed to this node by its
	// parent in a RowIter() call. This field is only non-nil if the entire
	// in-order traversal of the tree up to this point is Resolved().
	SchemaPrefix sql.Schema
}

TransformContext is the parameter to the Transform{,Selector}.

type TransformSelector added in v0.11.0

type TransformSelector func(TransformContext) bool

TransformSelector is a function which will allow TransformUpCtx to not traverse past a certain TransformContext. If this function returns |false| for a given TransformContext, the subtree is not transformed and the child is kept in its existing place in the parent as-is.

type TransformedNamedNode added in v0.11.0

type TransformedNamedNode struct {
	UnaryNode
	// contains filtered or unexported fields
}

func NewTransformedNamedNode added in v0.11.0

func NewTransformedNamedNode(child sql.Node, name string) *TransformedNamedNode

TransformedNamedNode is a wrapper for arbitrary logic to represent a table factor assembled from other nodes at some point in by the analyzer. See e.g., Concat.

func (*TransformedNamedNode) DebugString added in v0.11.0

func (n *TransformedNamedNode) DebugString() string

func (*TransformedNamedNode) Name added in v0.11.0

func (n *TransformedNamedNode) Name() string

func (*TransformedNamedNode) RowIter added in v0.11.0

func (n *TransformedNamedNode) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

func (*TransformedNamedNode) Schema added in v0.11.0

func (n *TransformedNamedNode) Schema() sql.Schema

func (*TransformedNamedNode) String added in v0.11.0

func (n *TransformedNamedNode) String() string

func (*TransformedNamedNode) WithChildren added in v0.11.0

func (n *TransformedNamedNode) WithChildren(children ...sql.Node) (sql.Node, error)

type Transformer added in v0.11.0

type Transformer func(TransformContext) (sql.Node, error)

Transformer is a function which will return new sql.Node values for a given TransformContext.

type TriggerBeginEndBlock added in v0.9.0

type TriggerBeginEndBlock struct {
	*BeginEndBlock
}

TriggerBeginEndBlock represents a BEGIN/END block specific to TRIGGER execution, which has special considerations regarding logic execution through the RowIter function.

func NewTriggerBeginEndBlock added in v0.9.0

func NewTriggerBeginEndBlock(block *BeginEndBlock) *TriggerBeginEndBlock

NewTriggerBeginEndBlock creates a new *TriggerBeginEndBlock node.

func (*TriggerBeginEndBlock) RowIter added in v0.9.0

func (b *TriggerBeginEndBlock) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*TriggerBeginEndBlock) WithChildren added in v0.9.0

func (b *TriggerBeginEndBlock) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the sql.Node interface.

type TriggerEvent

type TriggerEvent string

type TriggerExecutor

type TriggerExecutor struct {
	BinaryNode        // Left = wrapped node, Right = trigger execution logic
	TriggerEvent      TriggerEvent
	TriggerTime       TriggerTime
	TriggerDefinition sql.TriggerDefinition
}

TriggerExecutor is node that wraps, or is wrapped by, an INSERT, UPDATE, or DELETE node to execute defined trigger logic either before or after that operation. When a table has multiple triggers defined, TriggerExecutor nodes can wrap each other as well.

func NewTriggerExecutor

func NewTriggerExecutor(child, triggerLogic sql.Node, triggerEvent TriggerEvent, triggerTime TriggerTime, triggerDefinition sql.TriggerDefinition) *TriggerExecutor

func (*TriggerExecutor) DebugString

func (t *TriggerExecutor) DebugString() string

func (*TriggerExecutor) RowIter

func (t *TriggerExecutor) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

func (*TriggerExecutor) Schema

func (t *TriggerExecutor) Schema() sql.Schema

func (*TriggerExecutor) String

func (t *TriggerExecutor) String() string

func (*TriggerExecutor) WithChildren

func (t *TriggerExecutor) WithChildren(children ...sql.Node) (sql.Node, error)

type TriggerOrder

type TriggerOrder struct {
	PrecedesOrFollows string // PrecedesStr, FollowsStr
	OtherTriggerName  string
}

type TriggerTime

type TriggerTime string
const (
	BeforeTrigger TriggerTime = "before"
	AfterTrigger              = "after"
)

type Truncate

type Truncate struct {
	UnaryNode
	// contains filtered or unexported fields
}

Truncate is a node describing the deletion of all rows from some table.

func NewTruncate

func NewTruncate(db string, table sql.Node) *Truncate

NewTruncate creates a Truncate node.

func (*Truncate) DatabaseName

func (p *Truncate) DatabaseName() string

DatabaseName returns the name of the database that this operation is being performed in.

func (Truncate) DebugString

func (p Truncate) DebugString() string

DebugString implements the DebugStringer interface.

func (*Truncate) RowIter

func (p *Truncate) RowIter(ctx *sql.Context, _ sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (*Truncate) Schema

func (p *Truncate) Schema() sql.Schema

Schema implements the Node interface.

func (Truncate) String

func (p Truncate) String() string

String implements the Node interface.

func (*Truncate) WithChildren

func (p *Truncate) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

type UnaryNode

type UnaryNode struct {
	Child sql.Node
}

UnaryNode is a node that has only one child.

func (UnaryNode) Children

func (n UnaryNode) Children() []sql.Node

Children implements the Node interface.

func (UnaryNode) Resolved

func (n UnaryNode) Resolved() bool

Resolved implements the Resolvable interface.

func (*UnaryNode) Schema

func (n *UnaryNode) Schema() sql.Schema

Schema implements the Node interface.

type Union

type Union struct {
	BinaryNode
}

Union is a node that returns everything in Left and then everything in Right

func NewUnion

func NewUnion(left, right sql.Node) *Union

NewUnion creates a new Union node with the given children.

func (Union) DebugString

func (u Union) DebugString() string

func (*Union) Opaque

func (u *Union) Opaque() bool

Opaque implements the sql.OpaqueNode interface. Like SubqueryAlias, the selects in a Union must be evaluated in isolation.

func (*Union) RowIter

func (u *Union) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (*Union) Schema

func (u *Union) Schema() sql.Schema

func (Union) String

func (u Union) String() string

func (*Union) WithChildren

func (u *Union) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

type UnlockTables

type UnlockTables struct {
	Catalog sql.Catalog
}

UnlockTables will release all locks for the current session.

func NewUnlockTables

func NewUnlockTables() *UnlockTables

NewUnlockTables returns a new UnlockTables node.

func (*UnlockTables) Children

func (t *UnlockTables) Children() []sql.Node

Children implements the sql.Node interface.

func (*UnlockTables) Resolved

func (t *UnlockTables) Resolved() bool

Resolved implements the sql.Node interface.

func (*UnlockTables) RowIter

func (t *UnlockTables) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*UnlockTables) Schema

func (t *UnlockTables) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*UnlockTables) String

func (t *UnlockTables) String() string

func (*UnlockTables) WithChildren

func (t *UnlockTables) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

type UnresolvedTable

type UnresolvedTable struct {
	Database string
	AsOf     sql.Expression
	// contains filtered or unexported fields
}

UnresolvedTable is a table that has not been resolved yet but whose name is known.

func NewUnresolvedTable

func NewUnresolvedTable(name, db string) *UnresolvedTable

NewUnresolvedTable creates a new Unresolved table.

func NewUnresolvedTableAsOf

func NewUnresolvedTableAsOf(name, db string, asOf sql.Expression) *UnresolvedTable

NewUnresolvedTableAsOf creates a new Unresolved table with an AS OF expression.

func (*UnresolvedTable) Children

func (*UnresolvedTable) Children() []sql.Node

Children implements the Node interface.

func (*UnresolvedTable) Expressions added in v0.11.0

func (t *UnresolvedTable) Expressions() []sql.Expression

func (*UnresolvedTable) Name

func (t *UnresolvedTable) Name() string

Name implements the Nameable interface.

func (*UnresolvedTable) Resolved

func (*UnresolvedTable) Resolved() bool

Resolved implements the Resolvable interface.

func (*UnresolvedTable) RowIter

func (*UnresolvedTable) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the RowIter interface.

func (*UnresolvedTable) Schema

func (*UnresolvedTable) Schema() sql.Schema

Schema implements the Node interface.

func (UnresolvedTable) String

func (t UnresolvedTable) String() string

func (*UnresolvedTable) WithAsOf

func (t *UnresolvedTable) WithAsOf(asOf sql.Expression) (*UnresolvedTable, error)

WithAsOf returns a copy of this unresolved table with its AsOf field set to the given value. Analagous to WithChildren. This type is the only Node that can take an AS OF expression, so this isn't an interface.

func (*UnresolvedTable) WithChildren

func (t *UnresolvedTable) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (*UnresolvedTable) WithDatabase

func (t *UnresolvedTable) WithDatabase(database string) (*UnresolvedTable, error)

WithDatabase returns a copy of this unresolved table with its Database field set to the given value. Analagous to WithChildren.

func (*UnresolvedTable) WithExpressions added in v0.11.0

func (t *UnresolvedTable) WithExpressions(expressions ...sql.Expression) (sql.Node, error)

type Update

type Update struct {
	UnaryNode
	Checks sql.CheckConstraints
}

Update is a node for updating rows on tables.

func NewUpdate

func NewUpdate(n sql.Node, updateExprs []sql.Expression) *Update

NewUpdate creates an Update node.

func (*Update) Database added in v0.9.0

func (u *Update) Database() string

func (*Update) DebugString

func (u *Update) DebugString() string

func (*Update) Expressions added in v0.10.0

func (u *Update) Expressions() []sql.Expression

func (*Update) Resolved added in v0.10.0

func (u *Update) Resolved() bool

func (*Update) RowIter

func (u *Update) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (*Update) String

func (u *Update) String() string

func (*Update) WithChildren

func (u *Update) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (Update) WithExpressions added in v0.10.0

func (u Update) WithExpressions(newExprs ...sql.Expression) (sql.Node, error)

type UpdateInfo

type UpdateInfo struct {
	Matched, Updated, Warnings int
}

UpdateInfo is the Info for OKResults returned by Update nodes.

func (UpdateInfo) String

func (ui UpdateInfo) String() string

String implements fmt.Stringer

type UpdateJoin added in v0.11.0

type UpdateJoin struct {
	UnaryNode
	// contains filtered or unexported fields
}

func NewUpdateJoin added in v0.11.0

func NewUpdateJoin(editorMap map[string]sql.RowUpdater, child sql.Node) *UpdateJoin

NewUpdateJoin returns an *UpdateJoin node.

func (*UpdateJoin) GetUpdatable added in v0.11.0

func (u *UpdateJoin) GetUpdatable() sql.UpdatableTable

GetUpdatable returns an updateJoinTable which implements sql.UpdatableTable.

func (*UpdateJoin) RowIter added in v0.11.0

func (u *UpdateJoin) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (*UpdateJoin) String added in v0.11.0

func (u *UpdateJoin) String() string

String implements the sql.Node interface.

func (*UpdateJoin) WithChildren added in v0.11.0

func (u *UpdateJoin) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the sql.Node interface.

type UpdateSource

type UpdateSource struct {
	UnaryNode
	UpdateExprs []sql.Expression
}

UpdateSource is the source of updates for an Update node. Its schema is the concatenation of the old and new rows, before and after being updated.

func NewUpdateSource

func NewUpdateSource(node sql.Node, updateExprs []sql.Expression) *UpdateSource

NewUpdateSource returns a new UpdateSource from the node and expressions given.

func (*UpdateSource) DebugString

func (u *UpdateSource) DebugString() string

func (*UpdateSource) Expressions

func (u *UpdateSource) Expressions() []sql.Expression

Expressions implements the sql.Expressioner interface.

func (*UpdateSource) Resolved

func (u *UpdateSource) Resolved() bool

Resolved implements the Resolvable interface.

func (*UpdateSource) RowIter

func (u *UpdateSource) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

func (*UpdateSource) Schema

func (u *UpdateSource) Schema() sql.Schema

Schema implements sql.Node. The schema of an update is a concatenation of the old and new rows.

func (*UpdateSource) String

func (u *UpdateSource) String() string

func (*UpdateSource) WithChildren

func (u *UpdateSource) WithChildren(children ...sql.Node) (sql.Node, error)

func (*UpdateSource) WithExpressions

func (u *UpdateSource) WithExpressions(newExprs ...sql.Expression) (sql.Node, error)

WithExpressions implements the sql.Expressioner interface.

type Use

type Use struct {
	Catalog sql.Catalog
	// contains filtered or unexported fields
}

Use changes the current database.

func NewUse

func NewUse(db sql.Database) *Use

NewUse creates a new Use node.

func (Use) Children

func (Use) Children() []sql.Node

Children implements the sql.Node interface.

func (*Use) Database

func (u *Use) Database() sql.Database

Database implements the sql.Databaser interface.

func (*Use) Resolved

func (u *Use) Resolved() bool

Resolved implements the sql.Node interface.

func (*Use) RowIter

func (u *Use) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (Use) Schema

func (Use) Schema() sql.Schema

Schema implements the sql.Node interface.

func (*Use) String

func (u *Use) String() string

String implements the sql.Node interface.

func (*Use) WithChildren

func (u *Use) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (*Use) WithDatabase

func (u *Use) WithDatabase(db sql.Database) (sql.Node, error)

WithDatabase implements the sql.Databaser interface.

type ValueDerivedTable added in v0.9.0

type ValueDerivedTable struct {
	*Values
	// contains filtered or unexported fields
}

func NewValueDerivedTable added in v0.9.0

func NewValueDerivedTable(values *Values, name string) *ValueDerivedTable

func (*ValueDerivedTable) DebugString added in v0.9.0

func (v *ValueDerivedTable) DebugString() string

func (*ValueDerivedTable) Name added in v0.9.0

func (v *ValueDerivedTable) Name() string

Name implements sql.Nameable

func (*ValueDerivedTable) Schema added in v0.9.0

func (v *ValueDerivedTable) Schema() sql.Schema

Schema implements the Node interface.

func (*ValueDerivedTable) String added in v0.9.0

func (v *ValueDerivedTable) String() string

func (ValueDerivedTable) WithColumns added in v0.9.0

func (v ValueDerivedTable) WithColumns(columns []string) *ValueDerivedTable

func (*ValueDerivedTable) WithExpressions added in v0.9.0

func (v *ValueDerivedTable) WithExpressions(exprs ...sql.Expression) (sql.Node, error)

WithExpressions implements the Expressioner interface.

type Values

type Values struct {
	ExpressionTuples [][]sql.Expression
}

Values represents a set of tuples of expressions.

func NewValues

func NewValues(tuples [][]sql.Expression) *Values

NewValues creates a Values node with the given tuples.

func (*Values) Children

func (p *Values) Children() []sql.Node

Children implements the Node interface.

func (*Values) DebugString

func (p *Values) DebugString() string

func (*Values) Expressions

func (p *Values) Expressions() []sql.Expression

Expressions implements the Expressioner interface.

func (*Values) Resolved

func (p *Values) Resolved() bool

Resolved implements the Resolvable interface.

func (*Values) RowIter

func (p *Values) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements the Node interface.

func (*Values) Schema

func (p *Values) Schema() sql.Schema

Schema implements the Node interface.

func (*Values) String

func (p *Values) String() string

func (*Values) WithChildren

func (p *Values) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

func (*Values) WithExpressions

func (p *Values) WithExpressions(exprs ...sql.Expression) (sql.Node, error)

WithExpressions implements the Expressioner interface.

type Visitor

type Visitor interface {
	// Visit method is invoked for each node encountered by Walk.
	// If the result Visitor is not nil, Walk visits each of the children
	// of the node with that visitor, followed by a call of Visit(nil)
	// to the returned visitor.
	Visit(node sql.Node) Visitor
}

Visitor visits nodes in the plan.

type Window added in v0.9.0

type Window struct {
	SelectExprs []sql.Expression
	UnaryNode
}

func NewWindow added in v0.9.0

func NewWindow(selectExprs []sql.Expression, node sql.Node) *Window

func (*Window) DebugString added in v0.9.0

func (w *Window) DebugString() string

func (*Window) Expressions added in v0.9.0

func (w *Window) Expressions() []sql.Expression

Expressions implements sql.Expressioner

func (*Window) Resolved added in v0.9.0

func (w *Window) Resolved() bool

Resolved implements sql.Node

func (*Window) RowIter added in v0.9.0

func (w *Window) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

RowIter implements sql.Node

func (*Window) Schema added in v0.9.0

func (w *Window) Schema() sql.Schema

Schema implements sql.Node

func (*Window) String added in v0.9.0

func (w *Window) String() string

func (*Window) WithChildren added in v0.9.0

func (w *Window) WithChildren(children ...sql.Node) (sql.Node, error)

WithChildren implements sql.Node

func (*Window) WithExpressions added in v0.9.0

func (w *Window) WithExpressions(e ...sql.Expression) (sql.Node, error)

WithExpressions implements sql.Expressioner

type With added in v0.9.0

type With struct {
	UnaryNode
	CTEs []*CommonTableExpression
}

With is a node to wrap the top-level node in a query plan so that any common table expressions can be applied in analysis. It is removed during analysis.

func NewWith added in v0.9.0

func NewWith(child sql.Node, ctes []*CommonTableExpression) *With

func (*With) DebugString added in v0.9.0

func (w *With) DebugString() string

func (*With) RowIter added in v0.9.0

func (w *With) RowIter(ctx *sql.Context, row sql.Row) (sql.RowIter, error)

func (*With) String added in v0.9.0

func (w *With) String() string

func (*With) WithChildren added in v0.9.0

func (w *With) WithChildren(children ...sql.Node) (sql.Node, error)

Jump to

Keyboard shortcuts

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