plan

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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.Text},
}

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 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")
View Source
var ErrGroupBy = errors.NewKind("group by aggregation '%v' not supported")

ErrGroupBy is returned when the aggregation is not supported.

View Source
var ErrInsertIntoDuplicateColumn = errors.NewKind("duplicate column name %v")
View Source
var ErrInsertIntoMismatchValueCount = errors.NewKind("number of values does not match number of columns provided")
View Source
var ErrInsertIntoNonNullableDefaultNullColumn = errors.NewKind("column name '%v' is non-nullable but attempted to set default value of null")
View Source
var ErrInsertIntoNonNullableProvidedNull = errors.NewKind("column name '%v' is non-nullable but attempted to set a value of null")
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 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 ErrReplaceIntoNotSupported = errors.NewKind("table doesn't support REPLACE INTO")
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 ErrUnableSort = errors.NewKind("unable to sort")

ErrUnableSort is thrown when something happens on sorting

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")
View Source
var Nothing nothing

Nothing is a node that will return no rows.

Functions

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 expression.Inspect on any expression it finds.

func IsBinary

func IsBinary(node sql.Node) bool

IsBinary returns whether the node is binary or not.

func IsUnary

func IsUnary(node sql.Node) bool

IsUnary returns whether the node is unary or not.

func NewShowCreateTable

func NewShowCreateTable(db string, ctl *sql.Catalog, table string) sql.Node

NewShowCreateTable creates a new ShowCreateTable node.

func NewShowIndexes

func NewShowIndexes(db sql.Database, table string, registry *sql.IndexRegistry) sql.Node

NewShowIndexes creates a new ShowIndexes node.

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

func WalkExpressions

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

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

Types

type BinaryNode

type BinaryNode struct {
	Left  sql.Node
	Right sql.Node
}

BinaryNode is a node with two children.

func (BinaryNode) Children

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

Children implements the Node interface.

func (BinaryNode) Resolved

func (n BinaryNode) Resolved() bool

Resolved implements the Resolvable 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
	Async           bool
}

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

func (c *CreateIndex) IsAsync() bool

IsAsync implements the AsyncNode interface.

func (*CreateIndex) Resolved

func (c *CreateIndex) Resolved() bool

Resolved implements the Node interface.

func (*CreateIndex) RowIter

func (c *CreateIndex) RowIter(ctx *sql.Context) (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 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, schema sql.Schema) *CreateTable

NewCreateTable creates a new CreateTable node

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

func (c *CreateTable) Resolved() bool

Resolved implements the Resolvable interface.

func (*CreateTable) RowIter

func (c *CreateTable) RowIter(s *sql.Context) (sql.RowIter, error)

RowIter implements the Node interface.

func (*CreateTable) Schema

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

Schema implements the Node interface.

func (*CreateTable) String

func (c *CreateTable) String() string

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.

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

func (p *CrossJoin) Resolved() bool

Resolved implements the Resolvable interface.

func (*CrossJoin) RowIter

func (p *CrossJoin) RowIter(ctx *sql.Context) (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 DeleteFrom

type DeleteFrom struct {
	sql.Node
}

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

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

func (*DeleteFrom) Execute

func (p *DeleteFrom) Execute(ctx *sql.Context) (int, error)

Execute deletes the rows in the database.

func (*DeleteFrom) Resolved

func (p *DeleteFrom) Resolved() bool

Resolved implements the Resolvable interface.

func (*DeleteFrom) RowIter

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

RowIter implements the Node interface.

func (*DeleteFrom) Schema

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

Schema 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) (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 {
	UnaryNode
	Format string
}

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

func (d *DescribeQuery) RowIter(ctx *sql.Context) (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(children ...sql.Node) (sql.Node, error)

WithChildren implements the Node interface.

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

func (d *Distinct) Resolved() bool

Resolved implements the Resolvable interface.

func (*Distinct) RowIter

func (d *Distinct) RowIter(ctx *sql.Context) (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 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) (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 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 (d *DropTable) Children() []sql.Node

Children implements the Node interface.

func (*DropTable) Database

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

Database implements the sql.Databaser interface.

func (*DropTable) Resolved

func (d *DropTable) Resolved() bool

Resolved implements the Resolvable interface.

func (*DropTable) RowIter

func (d *DropTable) RowIter(s *sql.Context) (sql.RowIter, error)

RowIter implements the Node interface.

func (*DropTable) Schema

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

Schema implements the Node interface.

func (*DropTable) String

func (d *DropTable) String() string

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.

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

func (e *Exchange) RowIter(ctx *sql.Context) (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 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) Expressions

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

Expressions implements the Expressioner interface.

func (*Filter) Resolved

func (p *Filter) Resolved() bool

Resolved implements the Resolvable interface.

func (*Filter) RowIter

func (p *Filter) RowIter(ctx *sql.Context) (sql.RowIter, error)

RowIter implements the Node interface.

func (*Filter) String

func (p *Filter) String() string

func (*Filter) WithChildren

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

WithChildren implements the Node interface.

func (*Filter) WithExpressions

func (p *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() 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) (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
	Aggregate []sql.Expression
	Grouping  []sql.Expression
}

GroupBy groups the rows by some expressions.

func NewGroupBy

func NewGroupBy(
	aggregate []sql.Expression,
	grouping []sql.Expression,
	child sql.Node,
) *GroupBy

NewGroupBy creates a new GroupBy node.

func (*GroupBy) Expressions

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

Expressions implements the Expressioner interface.

func (*GroupBy) Resolved

func (p *GroupBy) Resolved() bool

Resolved implements the Resolvable interface.

func (*GroupBy) RowIter

func (p *GroupBy) RowIter(ctx *sql.Context) (sql.RowIter, error)

RowIter implements the Node interface.

func (*GroupBy) Schema

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

Schema implements the Node interface.

func (*GroupBy) String

func (p *GroupBy) String() string

func (*GroupBy) WithChildren

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

WithChildren implements the Node interface.

func (*GroupBy) WithExpressions

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

WithExpressions implements the Node interface.

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

type InnerJoin struct {
	BinaryNode
	Cond sql.Expression
}

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

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

Expressions implements the Expressioner interface.

func (*InnerJoin) Resolved

func (j *InnerJoin) Resolved() bool

Resolved implements the Resolvable interface.

func (*InnerJoin) RowIter

func (j *InnerJoin) RowIter(ctx *sql.Context) (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) WithExpressions

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

WithExpressions implements the Expressioner interface.

type InsertInto

type InsertInto struct {
	BinaryNode
	Columns   []string
	IsReplace bool
}

InsertInto is a node describing the insertion into some table.

func NewInsertInto

func NewInsertInto(dst, src sql.Node, isReplace bool, cols []string) *InsertInto

NewInsertInto creates an InsertInto node.

func (*InsertInto) Execute

func (p *InsertInto) Execute(ctx *sql.Context) (int, error)

Execute inserts the rows in the database.

func (*InsertInto) RowIter

func (p *InsertInto) RowIter(ctx *sql.Context) (sql.RowIter, error)

RowIter implements the Node interface.

func (*InsertInto) Schema

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

Schema implements the Node interface.

func (InsertInto) String

func (p InsertInto) String() string

func (*InsertInto) WithChildren

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

WithChildren implements the Node interface.

type LeftJoin

type LeftJoin struct {
	BinaryNode
	Cond sql.Expression
}

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

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

Expressions implements the Expressioner interface.

func (*LeftJoin) Resolved

func (j *LeftJoin) Resolved() bool

Resolved implements the Resolvable interface.

func (*LeftJoin) RowIter

func (j *LeftJoin) RowIter(ctx *sql.Context) (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) WithExpressions

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

WithExpressions implements the Expressioner interface.

type Limit

type Limit struct {
	UnaryNode
	Limit int64
}

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

func NewLimit

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

NewLimit creates a new Limit node with the given size.

func (*Limit) Resolved

func (l *Limit) Resolved() bool

Resolved implements the Resolvable interface.

func (*Limit) RowIter

func (l *Limit) RowIter(ctx *sql.Context) (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.

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) (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 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.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 NullOrdering

type NullOrdering byte

NullOrdering represents how to order based on null values.

const (
	// NullsFirst puts the null values before any other values.
	NullsFirst NullOrdering = iota
	// NullsLast puts the null values after all other values.
	NullsLast NullOrdering = 2
)

type Offset

type Offset struct {
	UnaryNode
	Offset int64
}

Offset is a node that skips the first N rows.

func NewOffset

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

NewOffset creates a new Offset node.

func (*Offset) Resolved

func (o *Offset) Resolved() bool

Resolved implements the Resolvable interface.

func (*Offset) RowIter

func (o *Offset) RowIter(ctx *sql.Context) (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.

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

type ProcessIndexableTable struct {
	sql.IndexableTable
	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.IndexableTable, onPartitionDone, onPartitionStart, OnRowNext NamedNotifyFunc) *ProcessIndexableTable

NewProcessIndexableTable returns a new ProcessIndexableTable.

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

func (p *QueryProcess) RowIter(ctx *sql.Context) (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 ResolvedTable

type ResolvedTable struct {
	sql.Table
}

ResolvedTable represents a resolved SQL Table.

func NewResolvedTable

func NewResolvedTable(table sql.Table) *ResolvedTable

NewResolvedTable creates a new instance of ResolvedTable.

func (*ResolvedTable) Children

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

Children implements the Node interface.

func (*ResolvedTable) Resolved

func (*ResolvedTable) Resolved() bool

Resolved implements the Resolvable interface.

func (*ResolvedTable) RowIter

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

RowIter implements the RowIter interface.

func (*ResolvedTable) WithChildren

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

WithChildren implements the Node interface.

type RightJoin

type RightJoin struct {
	BinaryNode
	Cond sql.Expression
}

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

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

Expressions implements the Expressioner interface.

func (*RightJoin) Resolved

func (j *RightJoin) Resolved() bool

Resolved implements the Resolvable interface.

func (*RightJoin) RowIter

func (j *RightJoin) RowIter(ctx *sql.Context) (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) WithExpressions

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

WithExpressions implements the Expressioner interface.

type Rollback

type Rollback struct{}

Rollback undoes the changes performed in a transaction.

func NewRollback

func NewRollback() *Rollback

NewRollback creates a new Rollback node.

func (*Rollback) Children

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

Children implements the sql.Node interface.

func (*Rollback) Resolved

func (*Rollback) Resolved() bool

Resolved implements the sql.Node interface.

func (*Rollback) RowIter

func (*Rollback) RowIter(*sql.Context) (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.

type Set

type Set struct {
	Variables []SetVariable
}

Set configuration variables. Right now, only session variables are supported.

func NewSet

func NewSet(vars ...SetVariable) *Set

NewSet creates a new Set node.

func (*Set) Children

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

Children implements the sql.Node interface.

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) (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 Node interface.

func (*Set) WithExpressions

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

WithExpressions implements the Expressioner interface.

type SetVariable

type SetVariable struct {
	Name  string
	Value sql.Expression
}

SetVariable is a key-value pair to represent the value that will be set on a variable.

type ShowCollation

type ShowCollation struct{}

ShowCollation shows all available collations.

func NewShowCollation

func NewShowCollation() ShowCollation

NewShowCollation creates a new ShowCollation node.

func (ShowCollation) Children

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

Children implements the sql.Node interface.

func (ShowCollation) Resolved

func (ShowCollation) Resolved() bool

Resolved implements the sql.Node interface.

func (ShowCollation) RowIter

func (ShowCollation) RowIter(ctx *sql.Context) (sql.RowIter, error)

RowIter implements the sql.Node interface.

func (ShowCollation) Schema

func (ShowCollation) Schema() sql.Schema

Schema implements the sql.Node interface.

func (ShowCollation) String

func (ShowCollation) String() string

func (ShowCollation) WithChildren

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

WithChildren implements the Node interface.

type ShowColumns

type ShowColumns struct {
	UnaryNode
	Full bool
}

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) (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) (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 {
	Catalog         *sql.Catalog
	CurrentDatabase string
	Table           string
}

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

func (*ShowCreateTable) Children

func (n *ShowCreateTable) Children() []sql.Node

Children implements the Node interface.

func (*ShowCreateTable) Resolved

func (n *ShowCreateTable) Resolved() bool

Resolved implements the Resolvable interface.

func (*ShowCreateTable) RowIter

func (n *ShowCreateTable) RowIter(*sql.Context) (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 Stringer interface.

func (*ShowCreateTable) WithChildren

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

WithChildren implements the Node 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) (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 ShowIndexes

type ShowIndexes struct {
	Table    string
	Registry *sql.IndexRegistry
	// contains filtered or unexported fields
}

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

func (*ShowIndexes) Children

func (n *ShowIndexes) Children() []sql.Node

Children implements the Node interface.

func (*ShowIndexes) Database

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

Database implements the sql.Databaser interface.

func (*ShowIndexes) Resolved

func (n *ShowIndexes) Resolved() bool

Resolved implements the Resolvable interface.

func (*ShowIndexes) RowIter

func (n *ShowIndexes) RowIter(*sql.Context) (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 Stringer interface.

func (*ShowIndexes) WithChildren

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

WithChildren implements the Node interface.

func (*ShowIndexes) WithDatabase

func (n *ShowIndexes) WithDatabase(db sql.Database) (sql.Node, error)

WithDatabase implements the sql.Databaser interface.

type ShowProcessList

type ShowProcessList struct {
	Database string
	*sql.ProcessList
}

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

type ShowTableStatus struct {
	Databases []string
	Catalog   *sql.Catalog
}

ShowTableStatus returns the status of the tables in the databases.

func NewShowTableStatus

func NewShowTableStatus(dbs ...string) *ShowTableStatus

NewShowTableStatus creates a new ShowTableStatus node.

func (*ShowTableStatus) Children

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

Children implements the sql.Node interface.

func (*ShowTableStatus) Resolved

func (s *ShowTableStatus) Resolved() bool

Resolved implements the sql.Node interface.

func (*ShowTableStatus) RowIter

func (s *ShowTableStatus) RowIter(ctx *sql.Context) (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.

type ShowTables

type ShowTables struct {
	Full bool
	// contains filtered or unexported fields
}

ShowTables is a node that shows the database tables.

func NewShowTables

func NewShowTables(database sql.Database, full bool) *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) Resolved

func (p *ShowTables) Resolved() bool

Resolved implements the Resolvable interface.

func (*ShowTables) RowIter

func (p *ShowTables) RowIter(ctx *sql.Context) (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.

type ShowVariables

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

ShowVariables is a node that shows the global and session variables

func NewShowVariables

func NewShowVariables(config map[string]sql.TypedValue, like string) *ShowVariables

NewShowVariables returns a new ShowVariables reference. config is a variables lookup table 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) (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 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) (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 Stringer interface.

func (ShowWarnings) WithChildren

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

WithChildren implements the Node interface.

type Sort

type Sort struct {
	UnaryNode
	SortFields []SortField
}

Sort is the sort node.

func NewSort

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

NewSort creates a new Sort node.

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

type SortField struct {
	// Column to order by.
	Column sql.Expression
	// Order type.
	Order SortOrder
	// NullOrdering defining how nulls will be ordered.
	NullOrdering NullOrdering
}

SortField is a field by which the query will be sorted.

type SortOrder

type SortOrder byte

SortOrder represents the order of the sort (ascending or descending).

const (
	// Ascending order.
	Ascending SortOrder = 1
	// Descending order.
	Descending SortOrder = 2
)

func (SortOrder) String

func (s SortOrder) String() string

type SubqueryAlias

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

SubqueryAlias is a node that gives a subquery a name.

func NewSubqueryAlias

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

NewSubqueryAlias creates a new SubqueryAlias node.

func (*SubqueryAlias) Name

func (n *SubqueryAlias) Name() string

Name implements the Table interface.

func (*SubqueryAlias) Opaque

func (n *SubqueryAlias) Opaque() bool

Opaque implements the OpaqueNode interface.

func (*SubqueryAlias) RowIter

func (n *SubqueryAlias) RowIter(ctx *sql.Context) (sql.RowIter, error)

RowIter implements the Node interface.

func (*SubqueryAlias) Schema

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

Schema implements the Node interface.

func (SubqueryAlias) String

func (n SubqueryAlias) String() string

func (*SubqueryAlias) WithChildren

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

WithChildren implements the Node interface.

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

func (t *TableAlias) Name() string

Name implements the Nameable interface.

func (*TableAlias) RowIter

func (t *TableAlias) RowIter(ctx *sql.Context) (sql.RowIter, error)

RowIter implements the Node interface.

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.

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 UnaryNode

type UnaryNode struct {
	Child sql.Node
}

UnaryNode is a node that has only one children.

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 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) (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
	// 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 (*UnresolvedTable) Children

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

Children implements the Node interface.

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

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

WithChildren implements the Node interface.

type Update

type Update struct {
	sql.Node
	UpdateExprs []sql.Expression
}

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

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

func (*Update) Execute

func (p *Update) Execute(ctx *sql.Context) (int, int, error)

Execute inserts the rows in the database.

func (*Update) Expressions

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

Expressions implements the Expressioner interface.

func (*Update) Resolved

func (p *Update) Resolved() bool

Resolved implements the Resolvable interface.

func (*Update) RowIter

func (p *Update) RowIter(ctx *sql.Context) (sql.RowIter, error)

RowIter implements the Node interface.

func (*Update) Schema

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

Schema implements the Node interface.

func (Update) String

func (p Update) String() string

func (*Update) WithChildren

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

WithChildren implements the Node interface.

func (*Update) WithExpressions

func (p *Update) WithExpressions(newExprs ...sql.Expression) (sql.Node, error)

WithExpressions implements the 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) (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 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) 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) (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 nul, 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL