Documentation ¶
Index ¶
- Constants
- Variables
- func EncodeExpressionHash(h ExpressionHash) string
- func IsArray(t Type) bool
- func IsDecimal(t Type) bool
- func IsInteger(t Type) bool
- func IsNumber(t Type) bool
- func IsSigned(t Type) bool
- func IsText(t Type) bool
- func IsTuple(t Type) bool
- func IsUnsigned(t Type) bool
- func MustConvert(t Type, v interface{}) interface{}
- func NumColumns(t Type) int
- type Aggregation
- type Alterable
- type AscendIndex
- type BaseSession
- type Catalog
- type Column
- type Context
- type ContextOption
- type Database
- type Databases
- type DescendIndex
- type Expression
- type ExpressionHash
- type Expressioner
- type Function
- type Function1
- type Function2
- type Function3
- type Function4
- type Function5
- type Function6
- type Function7
- type FunctionN
- type FunctionRegistry
- type Functions
- type Index
- type IndexDriver
- type IndexKeyValueIter
- type IndexLookup
- type IndexRegistry
- func (r *IndexRegistry) AddIndex(idx Index) (chan<- struct{}, error)
- func (r *IndexRegistry) CanUseIndex(idx Index) bool
- func (r *IndexRegistry) DefaultIndexDriver() IndexDriver
- func (r *IndexRegistry) DeleteIndex(db, id string, force bool) (<-chan struct{}, error)
- func (r *IndexRegistry) ExpressionsWithIndexes(db string, exprs ...Expression) [][]Expression
- func (r *IndexRegistry) Index(db, id string) Index
- func (r *IndexRegistry) IndexByExpression(db string, expr ...Expression) Index
- func (r *IndexRegistry) IndexDriver(id string) IndexDriver
- func (r *IndexRegistry) LoadIndexes(dbs Databases) error
- func (r *IndexRegistry) RegisterIndexDriver(driver IndexDriver)
- func (r *IndexRegistry) ReleaseIndex(idx Index)
- type IndexStatus
- type IndexValueIter
- type Indexable
- type Inserter
- type Mergeable
- type Nameable
- type Node
- type PushdownProjectionAndFiltersTable
- type PushdownProjectionTable
- type Resolvable
- type Row
- type RowIter
- type Schema
- type Session
- type SetOperations
- type Table
- type Tableable
- type TransformExprFunc
- type TransformNodeFunc
- type Transformable
- type TreePrinter
- type Type
- type UnresolvedDatabase
Constants ¶
const DateLayout = "2006-01-02"
DateLayout is the layout of the MySQL date format in the representation Go understands.
const TimestampLayout = "2006-01-02 15:04:05"
TimestampLayout is the formatting string with the layout of the timestamp using the format of Go "time" package.
Variables ¶
var ( // ErrInvalidType is thrown when there is an unexpected type at some part of // the execution tree. ErrInvalidType = errors.NewKind("invalid type: %s") // ErrTableAlreadyExists is thrown when someone tries to create a // table with a name of an existing one ErrTableAlreadyExists = errors.NewKind("table with name %s already exists") // ErrTableNotFound is returned when the table is not available from the // current scope. ErrTableNotFound = errors.NewKind("table not found: %s") //ErrUnexpectedRowLength is thrown when the obtained row has more columns than the schema ErrUnexpectedRowLength = errors.NewKind("expected %d values, got %d") )
var ( // ErrIndexIDAlreadyRegistered is the error returned when there is already // an index with the same ID. ErrIndexIDAlreadyRegistered = errors.NewKind("an index with id %q has already been registered") // ErrIndexExpressionAlreadyRegistered is the error returned when there is // already an index with the same expression. ErrIndexExpressionAlreadyRegistered = errors.NewKind("there is already an index registered for the expressions: %s") // ErrIndexNotFound is returned when the index could not be found. ErrIndexNotFound = errors.NewKind("index %q was not found") // ErrIndexDeleteInvalidStatus is returned when the index trying to delete // does not have a ready state. ErrIndexDeleteInvalidStatus = errors.NewKind("can't delete index %q because it's not ready for usage") )
var ( // ErrNodeNotWritten is returned when the children are printed before the node. ErrNodeNotWritten = errors.New("treeprinter: a child was written before the node") // ErrNodeAlreadyWritten is returned when the node has already been written. ErrNodeAlreadyWritten = errors.New("treeprinter: node already written") // ErrChildrenAlreadyWritten is returned when the children have already been written. ErrChildrenAlreadyWritten = errors.New("treeprinter: children already written") )
var ( // ErrTypeNotSupported is thrown when a specific type is not supported ErrTypeNotSupported = errors.NewKind("Type not supported: %s") // ErrUnexpectedType is thrown when a received type is not the expected ErrUnexpectedType = errors.NewKind("value at %d has unexpected type: %s") // ErrConvertingToTime is thrown when a value cannot be converted to a Time ErrConvertingToTime = errors.NewKind("value %q can't be converted to time.Time") // ErrValueNotNil is thrown when a value that was expected to be nil, is not ErrValueNotNil = errors.NewKind("value not nil: %#v") // ErrNotTuple is retuned when the value is not a tuple. ErrNotTuple = errors.NewKind("value of type %T is not a tuple") // ErrInvalidColumnNumber is returned when a tuple has an invalid number of // arguments. ErrInvalidColumnNumber = errors.NewKind("tuple should contain %d column(s), but has %d") // ErrNotArray is returned when the value is not an array. ErrNotArray = errors.NewKind("value of type %T is not an array") )
var ( // Null represents the null type. Null nullT // Int32 is an integer of 32 bits. Int32 = numberT{/* contains filtered or unexported fields */} // Int64 is an integer of 64 bytes. Int64 = numberT{/* contains filtered or unexported fields */} // Uint32 is an unsigned integer of 32 bytes. Uint32 = numberT{/* contains filtered or unexported fields */} // Uint64 is an unsigned integer of 64 bytes. Uint64 = numberT{/* contains filtered or unexported fields */} // Float32 is a floating point number of 32 bytes. Float32 = numberT{/* contains filtered or unexported fields */} // Float64 is a floating point number of 64 bytes. Float64 = numberT{/* contains filtered or unexported fields */} // Timestamp is an UNIX timestamp. Timestamp timestampT // Date is a date with day, month and year. Date dateT // Text is a string type. Text textT // Boolean is a boolean type. Boolean booleanT // JSON is a type that holds any valid JSON object. JSON jsonT // Blob is a type that holds a chunk of binary data. Blob blobT )
var ErrDatabaseNotFound = errors.NewKind("database not found: %s")
ErrDatabaseNotFound is thrown when a database is not found
var ErrFunctionNotFound = errors.NewKind("function not found: %s")
ErrFunctionNotFound is thrown when a function is not found
var ErrInvalidArgumentNumber = errors.NewKind("expecting %v arguments for calling this function, %d received")
ErrInvalidArgumentNumber is returned when the number of arguments to call a function is different from the function arity.
Functions ¶
func EncodeExpressionHash ¶
func EncodeExpressionHash(h ExpressionHash) string
EncodeExpressionHash encodes an ExpressionHash to hexadecimal string
func IsTuple ¶
IsTuple checks if t is a tuple type. Note that tupleT instances with just 1 value are not considered as a tuple, but a parenthesized value.
func MustConvert ¶
func MustConvert(t Type, v interface{}) interface{}
MustConvert calls the Convert function from a given Type, it err panics.
func NumColumns ¶
NumColumns returns the number of columns in a type. This is one for all types, except tuples.
Types ¶
type Aggregation ¶
type Aggregation interface { Expression // NewBuffer creates a new aggregation buffer and returns it as a Row. NewBuffer() Row // Update updates the given buffer with the given row. Update(ctx *Context, buffer, row Row) error // Merge merges a partial buffer into a global one. Merge(ctx *Context, buffer, partial Row) error }
Aggregation implements an aggregation expression, where an aggregation buffer is created for each grouping (NewBuffer) and rows in the grouping are fed to the buffer (Update). Multiple buffers can be merged (Merge), making partial aggregations possible. Note that Eval must be called with the final aggregation buffer in order to get the final result.
type AscendIndex ¶
type AscendIndex interface { // AscendGreaterOrEqual returns an IndexLookup for keys that are greater // or equal to the given keys. AscendGreaterOrEqual(keys ...interface{}) (IndexLookup, error) // AscendLessThan returns an IndexLookup for keys that are less than the // given keys. AscendLessThan(keys ...interface{}) (IndexLookup, error) // AscendRange returns an IndexLookup for keys that are within the given // range. AscendRange(greaterOrEqual, lessThan []interface{}) (IndexLookup, error) }
AscendIndex is an index that is sorted in ascending order.
type Catalog ¶
type Catalog struct { Databases FunctionRegistry *IndexRegistry }
Catalog holds databases, tables and functions.
type Column ¶
type Column struct { // Name is the name of the column. Name string // Type is the data type of the column. Type Type // Default contains the default value of the column or nil if it is NULL. Default interface{} // Nullable is true if the column can contain NULL values, or false // otherwise. Nullable bool // Source is the name of the table this column came from. Source string }
Column is the definition of a table column. As SQL:2016 puts it:
A column is a named component of a table. It has a data type, a default, and a nullability characteristic.
type Context ¶
Context of the query execution.
func NewContext ¶
func NewContext( ctx context.Context, opts ...ContextOption, ) *Context
NewContext creates a new query context. Options can be passed to configure the context. If some aspect of the context is not configure, the default value will be used. By default, the context will have an empty base session and a noop tracer.
func NewEmptyContext ¶
func NewEmptyContext() *Context
NewEmptyContext returns a default context with default values.
func (*Context) Span ¶
func (c *Context) Span( opName string, opts ...opentracing.StartSpanOption, ) (opentracing.Span, *Context)
Span creates a new tracing span with the given context. It will return the span and a new context that should be passed to all childrens of this span.
type ContextOption ¶
type ContextOption func(*Context)
ContextOption is a function to configure the context.
func WithSession ¶
func WithSession(s Session) ContextOption
WithSession adds the given session to the context.
func WithTracer ¶
func WithTracer(t opentracing.Tracer) ContextOption
WithTracer adds the given tracer to the context.
type Database ¶
type Database interface { Nameable // Tables returns the information of all tables. Tables() map[string]Table }
Database represents the database.
type Databases ¶
type Databases []Database
Databases is a collection of Database.
func (*Databases) AddDatabase ¶
AddDatabase adds a new database.
type DescendIndex ¶
type DescendIndex interface { // DescendGreater returns an IndexLookup for keys that are greater // than the given keys. DescendGreater(keys ...interface{}) (IndexLookup, error) // DescendLessOrEqual returns an IndexLookup for keys that are less than or // equal to the given keys. DescendLessOrEqual(keys ...interface{}) (IndexLookup, error) // DescendRange returns an IndexLookup for keys that are within the given // range. DescendRange(lessOrEqual, greaterThan []interface{}) (IndexLookup, error) }
DescendIndex is an index that is sorted in descending order.
type Expression ¶
type Expression interface { Resolvable fmt.Stringer // Type returns the expression type. Type() Type // IsNullable returns whether the expression can be null. IsNullable() bool // Eval evaluates the given row and returns a result. Eval(*Context, Row) (interface{}, error) // TransformUp transforms the expression and all its children with the // given transform function. TransformUp(TransformExprFunc) (Expression, error) // Children returns the children expressions of this expression. Children() []Expression }
Expression is a combination of one or more SQL expressions.
type ExpressionHash ¶
type ExpressionHash []byte
ExpressionHash is a SHA-1 checksum
func DecodeExpressionHash ¶
func DecodeExpressionHash(hexstr string) (ExpressionHash, error)
DecodeExpressionHash decodes a hexadecimal string to ExpressionHash
func NewExpressionHash ¶
func NewExpressionHash(ex Expression) ExpressionHash
NewExpressionHash returns a new SHA1 hash for given Expression instance. SHA1 checksum will be calculated based on ex.String().
type Expressioner ¶
type Expressioner interface { // Expressions returns the list of expressions contained by the node. Expressions() []Expression // TransformExpressions applies for each expression in this node // the expression's TransformUp method with the given function, and // return a new node with the transformed expressions. TransformExpressions(TransformExprFunc) (Node, error) }
Expressioner is a node that contains expressions.
type Function ¶
type Function interface { // Call invokes the function. Call(...Expression) (Expression, error) // contains filtered or unexported methods }
Function is a function defined by the user that can be applied in a SQL query.
type Function1 ¶
type Function1 func(e Expression) Expression
Function1 is a function with 1 argument.
func (Function1) Call ¶
func (fn Function1) Call(args ...Expression) (Expression, error)
Call implements the Function interface.
type Function2 ¶
type Function2 func(e1, e2 Expression) Expression
Function2 is a function with 2 arguments.
func (Function2) Call ¶
func (fn Function2) Call(args ...Expression) (Expression, error)
Call implements the Function interface.
type Function3 ¶
type Function3 func(e1, e2, e3 Expression) Expression
Function3 is a function with 3 arguments.
func (Function3) Call ¶
func (fn Function3) Call(args ...Expression) (Expression, error)
Call implements the Function interface.
type Function4 ¶
type Function4 func(e1, e2, e3, e4 Expression) Expression
Function4 is a function with 4 arguments.
func (Function4) Call ¶
func (fn Function4) Call(args ...Expression) (Expression, error)
Call implements the Function interface.
type Function5 ¶
type Function5 func(e1, e2, e3, e4, e5 Expression) Expression
Function5 is a function with 5 arguments.
func (Function5) Call ¶
func (fn Function5) Call(args ...Expression) (Expression, error)
Call implements the Function interface.
type Function6 ¶
type Function6 func(e1, e2, e3, e4, e5, e6 Expression) Expression
Function6 is a function with 6 arguments.
func (Function6) Call ¶
func (fn Function6) Call(args ...Expression) (Expression, error)
Call implements the Function interface.
type Function7 ¶
type Function7 func(e1, e2, e3, e4, e5, e6, e7 Expression) Expression
Function7 is a function with 7 arguments.
func (Function7) Call ¶
func (fn Function7) Call(args ...Expression) (Expression, error)
Call implements the Function interface.
type FunctionN ¶
type FunctionN func(...Expression) (Expression, error)
FunctionN is a function with variable number of arguments. This function is expected to return ErrInvalidArgumentNumber if the arity does not match, since the check has to be done in the implementation.
func (FunctionN) Call ¶
func (fn FunctionN) Call(args ...Expression) (Expression, error)
Call implements the Function interface.
type FunctionRegistry ¶
FunctionRegistry is used to register functions. It is used both for builtin and User-Defined Functions.
func NewFunctionRegistry ¶
func NewFunctionRegistry() FunctionRegistry
NewFunctionRegistry creates a new FunctionRegistry.
func (FunctionRegistry) Function ¶
func (r FunctionRegistry) Function(name string) (Function, error)
Function returns a function with the given name.
func (FunctionRegistry) RegisterFunction ¶
func (r FunctionRegistry) RegisterFunction(name string, f Function)
RegisterFunction registers a function with the given name.
func (FunctionRegistry) RegisterFunctions ¶
func (r FunctionRegistry) RegisterFunctions(funcs Functions)
RegisterFunctions registers a map of functions.
type Index ¶
type Index interface { // Get returns an IndexLookup for the given key in the index. Get(key ...interface{}) (IndexLookup, error) // Has checks if the given key is present in the index. Has(key ...interface{}) (bool, error) // ID returns the identifier of the index. ID() string // Database returns the database name this index belongs to. Database() string // Table returns the table name this index belongs to. Table() string // Expressions returns the indexed expressions. If the result is more than // one expression, it means the index has multiple columns indexed. If it's // just one, it means it may be an expression or a column. ExpressionHashes() []ExpressionHash // Driver ID of the index. Driver() string }
Index is the basic representation of an index. It can be extended with more functionality by implementing more specific interfaces.
type IndexDriver ¶
type IndexDriver interface { // ID returns the unique name of the driver. ID() string // Create a new index. If exprs is more than one expression, it means the // index has multiple columns indexed. If it's just one, it means it may // be an expression or a column. Create(db, table, id string, expressionHashes []ExpressionHash, config map[string]string) (Index, error) // LoadAll loads all indexes for given db and table LoadAll(db, table string) ([]Index, error) // Save the given index Save(ctx *Context, index Index, iter IndexKeyValueIter) error // Delete the given index. Delete(index Index) error }
IndexDriver manages the coordination between the indexes and their representation on disk.
type IndexKeyValueIter ¶
type IndexKeyValueIter interface { // Next returns the next tuple of index key values. The length of the // returned slice will be the same as the number of columns used to // create this iterator. The second returned parameter is a repo's location. Next() ([]interface{}, []byte, error) io.Closer }
IndexKeyValueIter is an iterator of index key values, that is, a tuple of the values that will be index keys.
type IndexLookup ¶
type IndexLookup interface { // Values returns the values in the subset of the index. Values() (IndexValueIter, error) }
IndexLookup is a subset of an index. More specific interfaces can be implemented to grant more capabilities to the index lookup.
type IndexRegistry ¶
type IndexRegistry struct { // Root path where all the data of the indexes is stored on disk. Root string // contains filtered or unexported fields }
IndexRegistry keeps track of all indexes in the engine.
func NewIndexRegistry ¶
func NewIndexRegistry() *IndexRegistry
NewIndexRegistry returns a new Index Registry.
func (*IndexRegistry) AddIndex ¶
func (r *IndexRegistry) AddIndex(idx Index) (chan<- struct{}, error)
AddIndex adds the given index to the registry. The added index will be marked as creating, so nobody can't register two indexes with the same expression or id while the other is still being created. When something is sent through the returned channel, it means the index has finished it's creation and will be marked as ready.
func (*IndexRegistry) CanUseIndex ¶
func (r *IndexRegistry) CanUseIndex(idx Index) bool
CanUseIndex returns whether the given index is ready to use or not.
func (*IndexRegistry) DefaultIndexDriver ¶
func (r *IndexRegistry) DefaultIndexDriver() IndexDriver
DefaultIndexDriver returns the default index driver, which is the only driver when there is 1 driver in the registry. If there are more than 1 drivers in the registry, this will return the empty string, as there is no clear default driver.
func (*IndexRegistry) DeleteIndex ¶
func (r *IndexRegistry) DeleteIndex(db, id string, force bool) (<-chan struct{}, error)
DeleteIndex deletes an index from the registry by its id. First, it marks the index for deletion but does not remove it, so queries that are using it may still do so. The returned channel will send a message when the index can be deleted from disk. If force is true, it will delete the index even if it's not ready for usage. Only use that parameter if you know what you're doing.
func (*IndexRegistry) ExpressionsWithIndexes ¶
func (r *IndexRegistry) ExpressionsWithIndexes( db string, exprs ...Expression, ) [][]Expression
ExpressionsWithIndexes finds all the combinations of expressions with matching indexes. This only matches multi-column indexes.
func (*IndexRegistry) Index ¶
func (r *IndexRegistry) Index(db, id string) Index
Index returns the index with the given id. It may return nil if the index is not found.
func (*IndexRegistry) IndexByExpression ¶
func (r *IndexRegistry) IndexByExpression(db string, expr ...Expression) Index
IndexByExpression returns an index by the given expression. It will return nil it the index is not found. If more than one expression is given, all of them must match for the index to be matched.
func (*IndexRegistry) IndexDriver ¶
func (r *IndexRegistry) IndexDriver(id string) IndexDriver
IndexDriver returns the IndexDriver with the given ID.
func (*IndexRegistry) LoadIndexes ¶
func (r *IndexRegistry) LoadIndexes(dbs Databases) error
LoadIndexes loads all indexes for all dbs, tables and drivers.
func (*IndexRegistry) RegisterIndexDriver ¶
func (r *IndexRegistry) RegisterIndexDriver(driver IndexDriver)
RegisterIndexDriver registers a new index driver.
func (*IndexRegistry) ReleaseIndex ¶
func (r *IndexRegistry) ReleaseIndex(idx Index)
ReleaseIndex releases an index after it's been used.
type IndexStatus ¶
type IndexStatus bool
IndexStatus represents the current status in which the index is.
const ( // IndexNotReady means the index is not ready to be used. IndexNotReady IndexStatus = false // IndexReady means the index can be used. IndexReady IndexStatus = true )
func (IndexStatus) IsUsable ¶
func (s IndexStatus) IsUsable() bool
IsUsable returns whether the index can be used or not based on the status.
func (IndexStatus) String ¶
func (s IndexStatus) String() string
type IndexValueIter ¶
type IndexValueIter interface { // Next returns the next value (repo's location) - see IndexKeyValueIter. Next() ([]byte, error) io.Closer }
IndexValueIter is an iterator of index values.
type Indexable ¶
type Indexable interface { PushdownProjectionAndFiltersTable // IndexKeyValueIter returns an iterator with the values of each row in // the table for the given column names. IndexKeyValueIter(ctx *Context, colNames []string) (IndexKeyValueIter, error) // WithProjectFiltersAndIndex is meant to be called instead of RowIter // method of the table. Returns a new iterator given the columns, // filters and the index so the table can improve its speed instead of // making a full scan. WithProjectFiltersAndIndex( ctx *Context, columns, filters []Expression, index IndexValueIter, ) (RowIter, error) }
Indexable represents a table that supports being indexed and receiving indexes to be able to speed up its execution.
type Mergeable ¶
type Mergeable interface { // IsMergeable checks whether the current IndexLookup can be merged with // the given one. IsMergeable(IndexLookup) bool }
Mergeable is a specialization of IndexLookup to check if an IndexLookup can be merged with another one.
type Nameable ¶
type Nameable interface { // Name returns the name. Name() string }
Nameable is something that has a name.
type Node ¶
type Node interface { Resolvable Transformable fmt.Stringer // Schema of the node. Schema() Schema // Children nodes. Children() []Node // RowIter produces a row iterator from this node. RowIter(*Context) (RowIter, error) }
Node is a node in the execution plan tree.
type PushdownProjectionAndFiltersTable ¶
type PushdownProjectionAndFiltersTable interface { Table // HandledFilters returns the subset of filters that can be handled by this // table. HandledFilters(filters []Expression) []Expression // WithProjectAndFilters replaces the RowIter method of the table and // return a new row iterator given the column names that are projected // and the filters applied to this table. WithProjectAndFilters(ctx *Context, columns, filters []Expression) (RowIter, error) }
PushdownProjectionAndFiltersTable is a table that can produce a specific RowIter that's more optimized given the columns that are projected and the filters for this table.
type PushdownProjectionTable ¶
type PushdownProjectionTable interface { Table // WithProject replaces the RowIter method of the table and returns a new // row iterator given the column names that are projected. WithProject(ctx *Context, colNames []string) (RowIter, error) }
PushdownProjectionTable is a table that can produce a specific RowIter that's more optimized given the columns that are projected.
type Resolvable ¶
type Resolvable interface { // Resolved returns whether the node is resolved. Resolved() bool }
Resolvable is something that can be resolved or not.
type Row ¶
type Row []interface{}
Row is a tuple of values.
func NodeToRows ¶
NodeToRows converts a node to a slice of rows.
func RowIterToRows ¶
RowIterToRows converts a row iterator to a slice of rows.
type RowIter ¶
type RowIter interface { // Next retrieves the next row. It will return io.EOF if it's the last row. // After retrieving the last row, Close will be automatically closed. Next() (Row, error) // Close the iterator. Close() error }
RowIter is an iterator that produces rows.
func NewSpanIter ¶
func NewSpanIter(span opentracing.Span, iter RowIter) RowIter
NewSpanIter creates a RowIter executed in the given span.
func RowsToRowIter ¶
RowsToRowIter creates a RowIter that iterates over the given rows.
type Schema ¶
type Schema []*Column
Schema is the definition of a table.
type SetOperations ¶
type SetOperations interface { // Intersection returns a new index subset with the intersection of the // current IndexLookup and the ones given. Intersection(...IndexLookup) IndexLookup // Union returns a new index subset with the union of the current // IndexLookup and the ones given. Union(...IndexLookup) IndexLookup // Difference returns a new index subset with the difference between the // current IndexLookup and the ones given. Difference(...IndexLookup) IndexLookup }
SetOperations is a specialization of IndexLookup that enables set operations between several IndexLookups.
type Tableable ¶
type Tableable interface { // Table returns the table name. Table() string }
Tableable is something that has a table.
type TransformExprFunc ¶
type TransformExprFunc func(Expression) (Expression, error)
TransformExprFunc is a function that given an expression will return that expression as is or transformed along with an error, if any.
type TransformNodeFunc ¶
TransformNodeFunc is a function that given a node will return that node as is or transformed along with an error, if any.
type Transformable ¶
type Transformable interface { // TransformUp transforms all nodes and returns the result of this transformation. // Transformation is not propagated to subqueries. TransformUp(TransformNodeFunc) (Node, error) // TransformExpressionsUp transforms all expressions inside the node and all its // children and returns a node with the result of the transformations. // Transformation is not propagated to subqueries. TransformExpressionsUp(TransformExprFunc) (Node, error) }
Transformable is a node which can be transformed.
type TreePrinter ¶
type TreePrinter struct {
// contains filtered or unexported fields
}
TreePrinter is a printer for tree nodes.
func (*TreePrinter) String ¶
func (p *TreePrinter) String() string
String returns the output of the printed tree.
func (*TreePrinter) WriteChildren ¶
func (p *TreePrinter) WriteChildren(children ...string) error
WriteChildren writes a children of the tree.
func (*TreePrinter) WriteNode ¶
func (p *TreePrinter) WriteNode(format string, args ...interface{}) error
WriteNode writes the main node.
type Type ¶
type Type interface { // Type returns the query.Type for the given Type. Type() query.Type // Covert a value of a compatible type to a most accurate type. Convert(interface{}) (interface{}, error) // Compare returns an integer comparing two values. // The result will be 0 if a==b, -1 if a < b, and +1 if a > b. Compare(interface{}, interface{}) (int, error) // SQL returns the sqltypes.Value for the given value. SQL(interface{}) sqltypes.Value }
Type represent a SQL type.
func MysqlTypeToType ¶
MysqlTypeToType gets the column type using the mysql type
type UnresolvedDatabase ¶
type UnresolvedDatabase struct{}
UnresolvedDatabase is a database which has not been resolved yet.
func (*UnresolvedDatabase) Name ¶
func (d *UnresolvedDatabase) Name() string
Name returns the database name, which is always "unresolved_database".
func (*UnresolvedDatabase) Tables ¶
func (d *UnresolvedDatabase) Tables() map[string]Table
Tables returns the tables in the database.