Documentation
¶
Index ¶
- Constants
- Variables
- func EncodeIndexValue(value *IndexValue) ([]byte, error)
- func NewDBProviderWithOpts(opts ...ProviderOption) sql.MutableDatabaseProvider
- func NewSessionBuilder(pro *DbProvider) func(ctx context.Context, conn *mysql.Conn, addr string) (sql.Session, error)
- type BaseDatabase
- func (d *BaseDatabase) AddTable(name string, t MemTable)
- func (d *BaseDatabase) CreateFulltextTableNames(ctx *sql.Context, parentTableName string, parentIndexName string) (fulltext.IndexTableNames, error)
- func (d *BaseDatabase) CreateIndexedTable(ctx *sql.Context, name string, sch sql.PrimaryKeySchema, idxDef sql.IndexDef, ...) error
- func (d *BaseDatabase) CreateTable(ctx *sql.Context, name string, schema sql.PrimaryKeySchema, ...) error
- func (d *BaseDatabase) CreateTrigger(_ *sql.Context, definition sql.TriggerDefinition) error
- func (d *BaseDatabase) Database() *BaseDatabase
- func (d *BaseDatabase) DropEvent(ctx *sql.Context, name string) error
- func (d *BaseDatabase) DropStoredProcedure(ctx *sql.Context, name string) error
- func (d *BaseDatabase) DropTable(ctx *sql.Context, name string) error
- func (d *BaseDatabase) DropTrigger(_ *sql.Context, name string) error
- func (d *BaseDatabase) EnablePrimaryKeyIndexes()
- func (d *BaseDatabase) GetCollation(ctx *sql.Context) sql.CollationID
- func (d *BaseDatabase) GetEvent(ctx *sql.Context, name string) (sql.EventDefinition, bool, error)
- func (d *BaseDatabase) GetEvents(ctx *sql.Context) ([]sql.EventDefinition, interface{}, error)
- func (d *BaseDatabase) GetForeignKeyCollection() *ForeignKeyCollection
- func (d *BaseDatabase) GetStoredProcedure(ctx *sql.Context, name string) (sql.StoredProcedureDetails, bool, error)
- func (d *BaseDatabase) GetStoredProcedures(ctx *sql.Context) ([]sql.StoredProcedureDetails, error)
- func (d *BaseDatabase) GetTableInsensitive(ctx *sql.Context, tblName string) (sql.Table, bool, error)
- func (d *BaseDatabase) GetTableNames(ctx *sql.Context) ([]string, error)
- func (d *BaseDatabase) GetTriggers(_ *sql.Context) ([]sql.TriggerDefinition, error)
- func (d *BaseDatabase) Name() string
- func (d *BaseDatabase) RenameTable(ctx *sql.Context, oldName, newName string) error
- func (d *BaseDatabase) SaveEvent(_ *sql.Context, event sql.EventDefinition) (bool, error)
- func (d *BaseDatabase) SaveStoredProcedure(ctx *sql.Context, spd sql.StoredProcedureDetails) error
- func (d *BaseDatabase) SetCollation(ctx *sql.Context, collation sql.CollationID) error
- func (d *BaseDatabase) Tables() map[string]sql.Table
- func (d *BaseDatabase) UpdateEvent(_ *sql.Context, originalName string, event sql.EventDefinition) (bool, error)
- func (d *BaseDatabase) UpdateLastExecuted(ctx *sql.Context, eventName string, lastExecuted time.Time) error
- func (d *BaseDatabase) ValidateSchema(schema sql.Schema) error
- type Database
- func (d *Database) AllViews(ctx *sql.Context) ([]sql.ViewDefinition, error)
- func (d *Database) CreateView(ctx *sql.Context, name string, selectStatement, createViewStmt string) error
- func (d *Database) Database() *BaseDatabase
- func (d *Database) DropView(ctx *sql.Context, name string) error
- func (d *Database) GetViewDefinition(ctx *sql.Context, viewName string) (sql.ViewDefinition, bool, error)
- func (d *Database) NeedsToReloadEvents(_ *sql.Context, token interface{}) (bool, error)
- type DbProvider
- func (pro *DbProvider) AllDatabases(*sql.Context) []sql.Database
- func (pro *DbProvider) CreateDatabase(_ *sql.Context, name string) (err error)
- func (pro *DbProvider) Database(_ *sql.Context, name string) (sql.Database, error)
- func (pro *DbProvider) DropDatabase(_ *sql.Context, name string) (err error)
- func (pro *DbProvider) ExternalStoredProcedure(_ *sql.Context, name string, numOfParams int) (*sql.ExternalStoredProcedureDetails, error)
- func (pro *DbProvider) ExternalStoredProcedures(_ *sql.Context, name string) ([]sql.ExternalStoredProcedureDetails, error)
- func (pro *DbProvider) HasDatabase(_ *sql.Context, name string) bool
- func (pro *DbProvider) TableFunction(_ *sql.Context, name string) (sql.TableFunction, error)
- func (pro *DbProvider) WithOption(opt ProviderOption)
- func (pro *DbProvider) WithTableFunctions(fns ...sql.TableFunction) (sql.TableFunctionProvider, error)
- type ExponentialDistTable
- func (s ExponentialDistTable) CheckPrivileges(_ *sql.Context, _ sql.PrivilegedOperationChecker) bool
- func (s ExponentialDistTable) Children() []sql.Node
- func (ExponentialDistTable) Collation() sql.CollationID
- func (ExponentialDistTable) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
- func (s ExponentialDistTable) Database() sql.Database
- func (s ExponentialDistTable) DebugString() string
- func (s ExponentialDistTable) Description() string
- func (s ExponentialDistTable) Expressions() []sql.Expression
- func (s ExponentialDistTable) IsReadOnly() bool
- func (s ExponentialDistTable) Name() string
- func (s ExponentialDistTable) NewInstance(_ *sql.Context, db sql.Database, args []sql.Expression) (sql.Node, error)
- func (s ExponentialDistTable) PartitionRows(ctx *sql.Context, _ sql.Partition) (sql.RowIter, error)
- func (s ExponentialDistTable) Partitions(ctx *sql.Context) (sql.PartitionIter, error)
- func (s ExponentialDistTable) Resolved() bool
- func (s ExponentialDistTable) RowIter(_ *sql.Context, _ sql.Row) (sql.RowIter, error)
- func (s ExponentialDistTable) Schema() sql.Schema
- func (s ExponentialDistTable) String() string
- func (s ExponentialDistTable) UnderlyingTable() sql.Table
- func (s ExponentialDistTable) WithChildren(_ ...sql.Node) (sql.Node, error)
- func (s ExponentialDistTable) WithDatabase(_ sql.Database) (sql.Node, error)
- func (s ExponentialDistTable) WithExpressions(e ...sql.Expression) (sql.Node, error)
- type ExpressionsIndex
- type FilteredTable
- type ForeignKeyCollection
- type GlobalsMap
- type HistoryDatabase
- func (db *HistoryDatabase) AddTableAsOf(name string, t sql.Table, asOf interface{})
- func (db *HistoryDatabase) GetTableInsensitiveAsOf(ctx *sql.Context, tblName string, time interface{}) (sql.Table, bool, error)
- func (db *HistoryDatabase) GetTableNamesAsOf(ctx *sql.Context, time interface{}) ([]string, error)
- type Index
- func (idx *Index) CanSupport(...sql.Range) bool
- func (idx *Index) ColumnExpressionTypes() []sql.ColumnExpressionType
- func (idx *Index) ColumnExpressions() []sql.Expression
- func (idx *Index) Comment() string
- func (idx *Index) Database() string
- func (idx *Index) Driver() string
- func (idx *Index) Expressions() []string
- func (idx *Index) ExtendedColumnExpressionTypes() []sql.ColumnExpressionType
- func (idx *Index) ExtendedExpressions() []string
- func (idx *Index) ExtendedExprs() []sql.Expression
- func (idx *Index) FullTextKeyColumns(ctx *sql.Context) (fulltext.KeyColumns, error)
- func (idx *Index) FullTextTableNames(ctx *sql.Context) (fulltext.IndexTableNames, error)
- func (idx *Index) HandledFilters(filters []sql.Expression) []sql.Expression
- func (idx *Index) ID() string
- func (idx *Index) IndexType() string
- func (idx *Index) IsFullText() bool
- func (idx *Index) IsGenerated() bool
- func (idx *Index) IsSpatial() bool
- func (idx *Index) IsUnique() bool
- func (idx *Index) MemTable() *Table
- func (idx *Index) Order() sql.IndexOrder
- func (idx *Index) PrefixLengths() []uint16
- func (idx *Index) Reversible() bool
- func (idx *Index) Table() string
- type IndexValue
- type IndexedTable
- type IntSequenceTable
- func (s IntSequenceTable) CheckPrivileges(_ *sql.Context, _ sql.PrivilegedOperationChecker) bool
- func (s IntSequenceTable) Children() []sql.Node
- func (IntSequenceTable) Collation() sql.CollationID
- func (IntSequenceTable) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
- func (s IntSequenceTable) Database() sql.Database
- func (s IntSequenceTable) DebugString() string
- func (s IntSequenceTable) Description() string
- func (s IntSequenceTable) Expressions() []sql.Expression
- func (s IntSequenceTable) GetIndexes(ctx *sql.Context) ([]sql.Index, error)
- func (s IntSequenceTable) IndexedAccess(lookup sql.IndexLookup) sql.IndexedTable
- func (s IntSequenceTable) IsReadOnly() bool
- func (s IntSequenceTable) LookupPartitions(context *sql.Context, lookup sql.IndexLookup) (sql.PartitionIter, error)
- func (s IntSequenceTable) Name() string
- func (s IntSequenceTable) NewInstance(_ *sql.Context, db sql.Database, args []sql.Expression) (sql.Node, error)
- func (s IntSequenceTable) PartitionRows(ctx *sql.Context, partition sql.Partition) (sql.RowIter, error)
- func (s IntSequenceTable) Partitions(ctx *sql.Context) (sql.PartitionIter, error)
- func (s IntSequenceTable) PreciseMatch() bool
- func (s IntSequenceTable) Resolved() bool
- func (s IntSequenceTable) RowIter(_ *sql.Context, _ sql.Row) (sql.RowIter, error)
- func (s IntSequenceTable) Schema() sql.Schema
- func (s IntSequenceTable) String() string
- func (s IntSequenceTable) UnderlyingTable() sql.Table
- func (s IntSequenceTable) WithChildren(_ ...sql.Node) (sql.Node, error)
- func (s IntSequenceTable) WithDatabase(_ sql.Database) (sql.Node, error)
- func (s IntSequenceTable) WithExpressions(e ...sql.Expression) (sql.Node, error)
- type MemTable
- type MemoryDatabase
- type NormalDistTable
- func (s NormalDistTable) CheckPrivileges(_ *sql.Context, _ sql.PrivilegedOperationChecker) bool
- func (s NormalDistTable) Children() []sql.Node
- func (NormalDistTable) Collation() sql.CollationID
- func (NormalDistTable) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
- func (s NormalDistTable) Database() sql.Database
- func (s NormalDistTable) DebugString() string
- func (s NormalDistTable) Description() string
- func (s NormalDistTable) Expressions() []sql.Expression
- func (s NormalDistTable) IsReadOnly() bool
- func (s NormalDistTable) Name() string
- func (s NormalDistTable) NewInstance(_ *sql.Context, db sql.Database, args []sql.Expression) (sql.Node, error)
- func (s NormalDistTable) PartitionRows(ctx *sql.Context, _ sql.Partition) (sql.RowIter, error)
- func (s NormalDistTable) Partitions(ctx *sql.Context) (sql.PartitionIter, error)
- func (s NormalDistTable) Resolved() bool
- func (s NormalDistTable) RowIter(_ *sql.Context, _ sql.Row) (sql.RowIter, error)
- func (s NormalDistTable) Schema() sql.Schema
- func (s NormalDistTable) String() string
- func (s NormalDistTable) UnderlyingTable() sql.Table
- func (s NormalDistTable) WithChildren(_ ...sql.Node) (sql.Node, error)
- func (s NormalDistTable) WithDatabase(_ sql.Database) (sql.Node, error)
- func (s NormalDistTable) WithExpressions(e ...sql.Expression) (sql.Node, error)
- type Partition
- type PointLookupTable
- func (s PointLookupTable) DebugString() string
- func (s PointLookupTable) Description() string
- func (s PointLookupTable) GetIndexes(ctx *sql.Context) (indexes []sql.Index, err error)
- func (s PointLookupTable) Name() string
- func (s PointLookupTable) NewInstance(ctx *sql.Context, db sql.Database, args []sql.Expression) (sql.Node, error)
- func (s PointLookupTable) PreciseMatch() bool
- func (s PointLookupTable) String() string
- func (s PointLookupTable) UnderlyingTable() sql.Table
- type ProviderOption
- type ReadOnlyDatabase
- type RequiredLookupTable
- func (s RequiredLookupTable) Database() sql.Database
- func (s RequiredLookupTable) DebugString() string
- func (s RequiredLookupTable) Description() string
- func (s RequiredLookupTable) Expressions() []sql.Expression
- func (s RequiredLookupTable) GetIndexes(ctx *sql.Context) (indexes []sql.Index, err error)
- func (s RequiredLookupTable) IndexedAccess(lookup sql.IndexLookup) sql.IndexedTable
- func (s RequiredLookupTable) Name() string
- func (s RequiredLookupTable) NewInstance(ctx *sql.Context, db sql.Database, args []sql.Expression) (sql.Node, error)
- func (s RequiredLookupTable) PartitionRows(ctx *sql.Context, partition sql.Partition) (sql.RowIter, error)
- func (s RequiredLookupTable) Partitions(ctx *sql.Context) (sql.PartitionIter, error)
- func (s RequiredLookupTable) PreciseMatch() bool
- func (s RequiredLookupTable) RequiredPredicates() []string
- func (s RequiredLookupTable) RowIter(_ *sql.Context, _ sql.Row) (sql.RowIter, error)
- func (s RequiredLookupTable) String() string
- func (s RequiredLookupTable) UnderlyingTable() sql.Table
- func (s RequiredLookupTable) WithChildren(_ ...sql.Node) (sql.Node, error)
- func (s RequiredLookupTable) WithDatabase(_ sql.Database) (sql.Node, error)
- func (s RequiredLookupTable) WithExpressions(e ...sql.Expression) (sql.Node, error)
- type SequenceTableFnRowIter
- type Session
- func (s *Session) CommitTransaction(ctx *sql.Context, tx sql.Transaction) error
- func (s *Session) CreateSavepoint(ctx *sql.Context, transaction sql.Transaction, name string) error
- func (s *Session) GetPersistedValue(k string) (interface{}, error)
- func (s *Session) PersistGlobal(sysVarName string, value interface{}) error
- func (s *Session) ReleaseSavepoint(ctx *sql.Context, transaction sql.Transaction, name string) error
- func (s *Session) RemoveAllPersistedGlobals() error
- func (s *Session) RemovePersistedGlobal(sysVarName string) error
- func (s *Session) Rollback(ctx *sql.Context, transaction sql.Transaction) error
- func (s *Session) RollbackToSavepoint(ctx *sql.Context, transaction sql.Transaction, name string) error
- func (s *Session) SetGlobals(globals map[string]interface{}) *Session
- func (s *Session) SetValidationCallback(validationCallback func()) *Session
- func (s *Session) StartTransaction(ctx *sql.Context, tCharacteristic sql.TransactionCharacteristic) (sql.Transaction, error)
- func (s *Session) ValidateSession(ctx *sql.Context) error
- type StatsProv
- func (s *StatsProv) DataLength(ctx *sql.Context, db, table string) (uint64, error)
- func (s *StatsProv) DropDbStats(ctx *sql.Context, db string, flush bool) error
- func (s *StatsProv) DropStats(ctx *sql.Context, qual sql.StatQualifier, cols []string) error
- func (s *StatsProv) GetStats(ctx *sql.Context, qual sql.StatQualifier, cols []string) (sql.Statistic, bool)
- func (s *StatsProv) GetTableStats(ctx *sql.Context, db, table string) ([]sql.Statistic, error)
- func (s *StatsProv) RefreshTableStats(ctx *sql.Context, table sql.Table, db string) error
- func (s *StatsProv) RowCount(ctx *sql.Context, db, table string) (uint64, error)
- func (s *StatsProv) SetStats(ctx *sql.Context, stats sql.Statistic) error
- type Table
- func NewDualTable() *Table
- func NewLocalTable(db MemoryDatabase, name string, schema sql.PrimaryKeySchema, ...) *Table
- func NewPartitionedTable(db *BaseDatabase, name string, schema sql.PrimaryKeySchema, ...) *Table
- func NewPartitionedTableWithCollation(db *BaseDatabase, name string, schema sql.PrimaryKeySchema, ...) *Table
- func NewTable(db MemoryDatabase, name string, schema sql.PrimaryKeySchema, ...) *Table
- func NewTableWithCollation(db *BaseDatabase, name string, schema sql.PrimaryKeySchema, ...) *Table
- func (t *Table) AddColumn(ctx *sql.Context, column *sql.Column, order *sql.ColumnOrder) error
- func (t *Table) AddForeignKey(ctx *sql.Context, fk sql.ForeignKeyConstraint) error
- func (t *Table) AutoIncrementSetter(ctx *sql.Context) sql.AutoIncrementSetter
- func (t *Table) BuildIndex(ctx *sql.Context, indexDef sql.IndexDef) (sql.RowInserter, error)
- func (t *Table) Collation() sql.CollationID
- func (t *Table) Comment() string
- func (t *Table) CreateCheck(ctx *sql.Context, check *sql.CheckDefinition) error
- func (t *Table) CreateFulltextIndex(ctx *sql.Context, indexDef sql.IndexDef, keyCols fulltext.KeyColumns, ...) error
- func (t *Table) CreateIndex(ctx *sql.Context, idx sql.IndexDef) error
- func (t *Table) CreateIndexForForeignKey(ctx *sql.Context, idx sql.IndexDef) error
- func (t *Table) CreatePrimaryKey(ctx *sql.Context, columns []sql.IndexColumn) error
- func (t *Table) DataLength(ctx *sql.Context) (uint64, error)
- func (t *Table) Database() string
- func (t *Table) DebugString() string
- func (t *Table) Deleter(ctx *sql.Context) sql.RowDeleter
- func (t *Table) DropCheck(ctx *sql.Context, chName string) error
- func (t *Table) DropColumn(ctx *sql.Context, columnName string) error
- func (t *Table) DropForeignKey(ctx *sql.Context, fkName string) error
- func (t *Table) DropIndex(ctx *sql.Context, name string) error
- func (t *Table) DropPrimaryKey(ctx *sql.Context) error
- func (t *Table) EnablePrimaryKeyIndexes()
- func (t *Table) Filters() []sql.Expression
- func (t *Table) GetChecks(ctx *sql.Context) ([]sql.CheckDefinition, error)
- func (t *Table) GetDeclaredForeignKeys(ctx *sql.Context) ([]sql.ForeignKeyConstraint, error)
- func (t *Table) GetForeignKeyEditor(ctx *sql.Context) sql.ForeignKeyEditor
- func (t *Table) GetIndexes(ctx *sql.Context) ([]sql.Index, error)
- func (t *Table) GetNextAutoIncrementValue(ctx *sql.Context, insertVal interface{}) (uint64, error)
- func (t *Table) GetPartition(key string) []sql.Row
- func (t *Table) GetReferencedForeignKeys(ctx *sql.Context) ([]sql.ForeignKeyConstraint, error)
- func (t *Table) HandledFilters(filters []sql.Expression) []sql.Expression
- func (t *Table) IgnoreSessionData() bool
- func (t *Table) IndexedAccess(lookup sql.IndexLookup) sql.IndexedTable
- func (t *Table) Insert(ctx *sql.Context, row sql.Row) error
- func (t *Table) Inserter(ctx *sql.Context) sql.RowInserter
- func (t *Table) ModifyColumn(ctx *sql.Context, columnName string, column *sql.Column, ...) error
- func (t *Table) ModifyDefaultCollation(ctx *sql.Context, collation sql.CollationID) error
- func (t *Table) ModifyStoredCollation(ctx *sql.Context, collation sql.CollationID) error
- func (t *Table) Name() string
- func (t *Table) PartitionCount(ctx *sql.Context) (int64, error)
- func (t *Table) PartitionRows(ctx *sql.Context, partition sql.Partition) (sql.RowIter, error)
- func (t *Table) Partitions(ctx *sql.Context) (sql.PartitionIter, error)
- func (t *Table) PeekNextAutoIncrementValue(ctx *sql.Context) (uint64, error)
- func (t *Table) PreciseMatch() bool
- func (t *Table) PrimaryKeySchema() sql.PrimaryKeySchema
- func (t *Table) Projections() []string
- func (t *Table) RenameIndex(ctx *sql.Context, fromIndexName string, toIndexName string) error
- func (t *Table) Replacer(ctx *sql.Context) sql.RowReplacer
- func (t *Table) RewriteInserter(ctx *sql.Context, oldSchema, newSchema sql.PrimaryKeySchema, _, _ *sql.Column, ...) (sql.RowInserter, error)
- func (t *Table) RowCount(ctx *sql.Context) (uint64, bool, error)
- func (t *Table) Schema() sql.Schema
- func (t *Table) SetForeignKeyResolved(ctx *sql.Context, fkName string) error
- func (t *Table) ShouldBuildIndex(ctx *sql.Context, indexDef sql.IndexDef) (bool, error)
- func (t *Table) ShouldRewriteTable(ctx *sql.Context, oldSchema, newSchema sql.PrimaryKeySchema, ...) bool
- func (t *Table) String() string
- func (t *Table) Truncate(ctx *sql.Context) (int, error)
- func (t *Table) UnderlyingTable() *Table
- func (t *Table) UpdateForeignKey(ctx *sql.Context, fkName string, fk sql.ForeignKeyConstraint) error
- func (t *Table) Updater(ctx *sql.Context) sql.RowUpdater
- func (t *Table) WithProjections(cols []string) sql.Table
- type TableData
- type TableFunc
- func (s TableFunc) CheckPrivileges(_ *sql.Context, _ sql.PrivilegedOperationChecker) bool
- func (s TableFunc) Children() []sql.Node
- func (TableFunc) Collation() sql.CollationID
- func (TableFunc) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
- func (s TableFunc) Database() sql.Database
- func (s TableFunc) DebugString() string
- func (s TableFunc) Description() string
- func (s TableFunc) Expressions() []sql.Expression
- func (s TableFunc) IsReadOnly() bool
- func (s TableFunc) Name() string
- func (s TableFunc) NewInstance(_ *sql.Context, db sql.Database, args []sql.Expression) (sql.Node, error)
- func (s TableFunc) Resolved() bool
- func (s TableFunc) RowIter(_ *sql.Context, _ sql.Row) (sql.RowIter, error)
- func (s TableFunc) Schema() sql.Schema
- func (s TableFunc) String() string
- func (s TableFunc) WithChildren(_ ...sql.Node) (sql.Node, error)
- func (s TableFunc) WithDatabase(_ sql.Database) (sql.Node, error)
- func (s TableFunc) WithExpressions(e ...sql.Expression) (sql.Node, error)
- type TableFunctionRowIter
- type TableRevision
- type TestIndexDriver
- func (d *TestIndexDriver) Create(db, table, id string, expressions []sql.Expression, config map[string]string) (sql.DriverIndex, error)
- func (d *TestIndexDriver) Delete(sql.DriverIndex, sql.PartitionIter) error
- func (d *TestIndexDriver) ID() string
- func (d *TestIndexDriver) LoadAll(ctx *sql.Context, db, table string) ([]sql.DriverIndex, error)
- func (d *TestIndexDriver) Save(*sql.Context, sql.DriverIndex, sql.PartitionIndexKeyValueIter) error
- type Transaction
Constants ¶
const CommentPreventingIndexBuilding = "__FOR TESTING: I cannot be built__"
const DualTableName = ""
const IndexDriverId = "MemoryIndexDriver"
Variables ¶
var DualTableSchema = sql.NewPrimaryKeySchema(sql.Schema{ {Name: "", Source: DualTableName, Type: types.LongText, Nullable: false}, })
var ( ExternalStoredProcedures = []sql.ExternalStoredProcedureDetails{ { Name: "memory_inout_add", Schema: nil, Function: inout_add, }, { Name: "memory_inout_set_unitialized", Schema: nil, Function: inout_set_unitialized, }, { Name: "memory_overloaded_mult", Schema: externalSPSchemaInt, Function: overloaded_mult1, }, { Name: "memory_overloaded_mult", Schema: externalSPSchemaInt, Function: overloaded_mult2, }, { Name: "memory_overloaded_mult", Schema: externalSPSchemaInt, Function: overloaded_mult3, }, { Name: "memory_overloaded_type_test", Schema: externalSPSchemaInt, Function: overloaded_type_test1, }, { Name: "memory_overloaded_type_test", Schema: externalSPSchemaText, Function: overloaded_type_test2, }, { Name: "memory_type_test3", Schema: externalSPSchemaUint, Function: type_test3, }, { Name: "memory_inout_bool_byte", Schema: nil, Function: inout_bool_byte, }, { Name: "memory_error_table_not_found", Schema: nil, Function: error_table_not_found, }, { Name: "memory_variadic_add", Schema: externalSPSchemaInt, Function: variadic_add, }, { Name: "memory_variadic_byte_slice", Schema: externalSPSchemaText, Function: variadic_byte_slice, }, { Name: "memory_variadic_overload", Schema: externalSPSchemaText, Function: variadic_overload1, }, { Name: "memory_variadic_overload", Schema: externalSPSchemaText, Function: variadic_overload2, }, { Name: "memory_inout_add_readonly", Schema: externalSPSchemaInt, Function: variadic_add, ReadOnly: true, }, { Name: "memory_inout_add_readwrite", Schema: externalSPSchemaInt, Function: variadic_add, ReadOnly: false, }, { Name: "memory_admin_only", Schema: externalSPSchemaInt, Function: variadic_add, ReadOnly: false, AdminOnly: true, }, } )
Functions ¶
func EncodeIndexValue ¶ added in v0.9.0
func EncodeIndexValue(value *IndexValue) ([]byte, error)
func NewDBProviderWithOpts ¶ added in v0.15.0
func NewDBProviderWithOpts(opts ...ProviderOption) sql.MutableDatabaseProvider
NewDBProviderWithOpts creates a new DbProvider with the given options and no databases
func NewSessionBuilder ¶ added in v0.18.1
func NewSessionBuilder(pro *DbProvider) func(ctx context.Context, conn *mysql.Conn, addr string) (sql.Session, error)
NewSessionBuilder returns a session for the given in-memory database provider suitable to use in a test server This can't be defined as server.SessionBuilder because importing it would create a circular dependency, but it's the same signature.
Types ¶
type BaseDatabase ¶ added in v0.11.0
type BaseDatabase struct {
// contains filtered or unexported fields
}
BaseDatabase is an in-memory database that can't store views, only for testing the engine
func NewViewlessDatabase ¶ added in v0.11.0
func NewViewlessDatabase(name string) *BaseDatabase
NewViewlessDatabase creates a new database that doesn't persist views. Used only for testing. Use NewDatabase.
func (*BaseDatabase) AddTable ¶ added in v0.11.0
func (d *BaseDatabase) AddTable(name string, t MemTable)
AddTable adds a new table to the database.
func (*BaseDatabase) CreateFulltextTableNames ¶ added in v0.17.0
func (d *BaseDatabase) CreateFulltextTableNames(ctx *sql.Context, parentTableName string, parentIndexName string) (fulltext.IndexTableNames, error)
func (*BaseDatabase) CreateIndexedTable ¶ added in v0.15.0
func (d *BaseDatabase) CreateIndexedTable(ctx *sql.Context, name string, sch sql.PrimaryKeySchema, idxDef sql.IndexDef, collation sql.CollationID) error
CreateIndexedTable creates a table with the given name and schema
func (*BaseDatabase) CreateTable ¶ added in v0.11.0
func (d *BaseDatabase) CreateTable(ctx *sql.Context, name string, schema sql.PrimaryKeySchema, collation sql.CollationID, comment string) error
CreateTable creates a table with the given name and schema
func (*BaseDatabase) CreateTrigger ¶ added in v0.11.0
func (d *BaseDatabase) CreateTrigger(_ *sql.Context, definition sql.TriggerDefinition) error
func (*BaseDatabase) Database ¶ added in v0.18.0
func (d *BaseDatabase) Database() *BaseDatabase
func (*BaseDatabase) DropEvent ¶ added in v0.15.0
func (d *BaseDatabase) DropEvent(ctx *sql.Context, name string) error
DropEvent implements sql.EventDatabase
func (*BaseDatabase) DropStoredProcedure ¶ added in v0.11.0
func (d *BaseDatabase) DropStoredProcedure(ctx *sql.Context, name string) error
DropStoredProcedure implements sql.StoredProcedureDatabase
func (*BaseDatabase) DropTable ¶ added in v0.11.0
func (d *BaseDatabase) DropTable(ctx *sql.Context, name string) error
DropTable drops the table with the given name
func (*BaseDatabase) DropTrigger ¶ added in v0.11.0
func (d *BaseDatabase) DropTrigger(_ *sql.Context, name string) error
func (*BaseDatabase) EnablePrimaryKeyIndexes ¶ added in v0.11.0
func (d *BaseDatabase) EnablePrimaryKeyIndexes()
EnablePrimaryKeyIndexes causes every table created in this database to use an index on its primary partitionKeys
func (*BaseDatabase) GetCollation ¶ added in v0.14.0
func (d *BaseDatabase) GetCollation(ctx *sql.Context) sql.CollationID
GetCollation implements sql.CollatedDatabase.
func (*BaseDatabase) GetEvent ¶ added in v0.15.0
func (d *BaseDatabase) GetEvent(ctx *sql.Context, name string) (sql.EventDefinition, bool, error)
GetEvent implements sql.EventDatabase
func (*BaseDatabase) GetEvents ¶ added in v0.15.0
func (d *BaseDatabase) GetEvents(ctx *sql.Context) ([]sql.EventDefinition, interface{}, error)
GetEvents implements sql.EventDatabase
func (*BaseDatabase) GetForeignKeyCollection ¶ added in v0.12.0
func (d *BaseDatabase) GetForeignKeyCollection() *ForeignKeyCollection
func (*BaseDatabase) GetStoredProcedure ¶ added in v0.15.0
func (d *BaseDatabase) GetStoredProcedure(ctx *sql.Context, name string) (sql.StoredProcedureDetails, bool, error)
GetStoredProcedure implements sql.StoredProcedureDatabase
func (*BaseDatabase) GetStoredProcedures ¶ added in v0.11.0
func (d *BaseDatabase) GetStoredProcedures(ctx *sql.Context) ([]sql.StoredProcedureDetails, error)
GetStoredProcedures implements sql.StoredProcedureDatabase
func (*BaseDatabase) GetTableInsensitive ¶ added in v0.11.0
func (*BaseDatabase) GetTableNames ¶ added in v0.11.0
func (d *BaseDatabase) GetTableNames(ctx *sql.Context) ([]string, error)
func (*BaseDatabase) GetTriggers ¶ added in v0.11.0
func (d *BaseDatabase) GetTriggers(_ *sql.Context) ([]sql.TriggerDefinition, error)
func (*BaseDatabase) Name ¶ added in v0.11.0
func (d *BaseDatabase) Name() string
Name returns the database name.
func (*BaseDatabase) RenameTable ¶ added in v0.11.0
func (d *BaseDatabase) RenameTable(ctx *sql.Context, oldName, newName string) error
func (*BaseDatabase) SaveEvent ¶ added in v0.15.0
func (d *BaseDatabase) SaveEvent(_ *sql.Context, event sql.EventDefinition) (bool, error)
SaveEvent implements sql.EventDatabase
func (*BaseDatabase) SaveStoredProcedure ¶ added in v0.11.0
func (d *BaseDatabase) SaveStoredProcedure(ctx *sql.Context, spd sql.StoredProcedureDetails) error
SaveStoredProcedure implements sql.StoredProcedureDatabase
func (*BaseDatabase) SetCollation ¶ added in v0.14.0
func (d *BaseDatabase) SetCollation(ctx *sql.Context, collation sql.CollationID) error
SetCollation implements sql.CollatedDatabase.
func (*BaseDatabase) Tables ¶ added in v0.11.0
func (d *BaseDatabase) Tables() map[string]sql.Table
Tables returns all tables in the database.
func (*BaseDatabase) UpdateEvent ¶ added in v0.15.0
func (d *BaseDatabase) UpdateEvent(_ *sql.Context, originalName string, event sql.EventDefinition) (bool, error)
UpdateEvent implements sql.EventDatabase
func (*BaseDatabase) UpdateLastExecuted ¶ added in v0.18.0
func (d *BaseDatabase) UpdateLastExecuted(ctx *sql.Context, eventName string, lastExecuted time.Time) error
UpdateLastExecuted implements sql.EventDatabase
func (*BaseDatabase) ValidateSchema ¶ added in v0.18.0
func (d *BaseDatabase) ValidateSchema(schema sql.Schema) error
ValidateSchema implements sql.SchemaValidator
type Database ¶
type Database struct { *BaseDatabase // contains filtered or unexported fields }
Database is an in-memory database.
func NewDatabase ¶
NewDatabase creates a new database with the given name.
func (*Database) CreateView ¶ added in v0.11.0
func (d *Database) CreateView(ctx *sql.Context, name string, selectStatement, createViewStmt string) error
CreateView implements the interface sql.ViewDatabase.
func (*Database) Database ¶ added in v0.18.0
func (d *Database) Database() *BaseDatabase
func (*Database) GetViewDefinition ¶ added in v0.15.0
func (d *Database) GetViewDefinition(ctx *sql.Context, viewName string) (sql.ViewDefinition, bool, error)
GetViewDefinition implements the interface sql.ViewDatabase.
type DbProvider ¶ added in v0.15.0
type DbProvider struct {
// contains filtered or unexported fields
}
DbProvider is a provider for in-memory databases
func NewDBProvider ¶ added in v0.15.0
func NewDBProvider(dbs ...sql.Database) *DbProvider
NewDBProvider creates a new DbProvider with the default options and the databases specified
func (*DbProvider) AllDatabases ¶ added in v0.15.0
func (pro *DbProvider) AllDatabases(*sql.Context) []sql.Database
AllDatabases returns the Database with the given name if it exists.
func (*DbProvider) CreateDatabase ¶ added in v0.15.0
func (pro *DbProvider) CreateDatabase(_ *sql.Context, name string) (err error)
CreateDatabase implements MutableDatabaseProvider.
func (*DbProvider) Database ¶ added in v0.15.0
Database returns the Database with the given name if it exists.
func (*DbProvider) DropDatabase ¶ added in v0.15.0
func (pro *DbProvider) DropDatabase(_ *sql.Context, name string) (err error)
DropDatabase implements MutableDatabaseProvider.
func (*DbProvider) ExternalStoredProcedure ¶ added in v0.15.0
func (pro *DbProvider) ExternalStoredProcedure(_ *sql.Context, name string, numOfParams int) (*sql.ExternalStoredProcedureDetails, error)
ExternalStoredProcedure implements sql.ExternalStoredProcedureProvider
func (*DbProvider) ExternalStoredProcedures ¶ added in v0.15.0
func (pro *DbProvider) ExternalStoredProcedures(_ *sql.Context, name string) ([]sql.ExternalStoredProcedureDetails, error)
ExternalStoredProcedures implements sql.ExternalStoredProcedureProvider
func (*DbProvider) HasDatabase ¶ added in v0.15.0
func (pro *DbProvider) HasDatabase(_ *sql.Context, name string) bool
HasDatabase returns the Database with the given name if it exists.
func (*DbProvider) TableFunction ¶ added in v0.15.0
func (pro *DbProvider) TableFunction(_ *sql.Context, name string) (sql.TableFunction, error)
TableFunction implements sql.TableFunctionProvider
func (*DbProvider) WithOption ¶ added in v0.15.0
func (pro *DbProvider) WithOption(opt ProviderOption)
WithOption modifies the provider with the given option
func (*DbProvider) WithTableFunctions ¶ added in v0.18.0
func (pro *DbProvider) WithTableFunctions(fns ...sql.TableFunction) (sql.TableFunctionProvider, error)
type ExponentialDistTable ¶ added in v0.18.0
type ExponentialDistTable struct {
// contains filtered or unexported fields
}
ExponentialDistTable a simple table function that returns samples from a parameterized exponential distribution.
func (ExponentialDistTable) CheckPrivileges ¶ added in v0.18.0
func (s ExponentialDistTable) CheckPrivileges(_ *sql.Context, _ sql.PrivilegedOperationChecker) bool
func (ExponentialDistTable) Children ¶ added in v0.18.0
func (s ExponentialDistTable) Children() []sql.Node
func (ExponentialDistTable) Collation ¶ added in v0.18.0
func (ExponentialDistTable) Collation() sql.CollationID
Collation implements the sql.Table interface.
func (ExponentialDistTable) CollationCoercibility ¶ added in v0.18.0
func (ExponentialDistTable) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
CollationCoercibility implements the interface sql.CollationCoercible.
func (ExponentialDistTable) Database ¶ added in v0.18.0
func (s ExponentialDistTable) Database() sql.Database
func (ExponentialDistTable) DebugString ¶ added in v0.18.0
func (s ExponentialDistTable) DebugString() string
func (ExponentialDistTable) Description ¶ added in v0.18.0
func (s ExponentialDistTable) Description() string
func (ExponentialDistTable) Expressions ¶ added in v0.18.0
func (s ExponentialDistTable) Expressions() []sql.Expression
func (ExponentialDistTable) IsReadOnly ¶ added in v0.18.0
func (s ExponentialDistTable) IsReadOnly() bool
func (ExponentialDistTable) Name ¶ added in v0.18.0
func (s ExponentialDistTable) Name() string
func (ExponentialDistTable) NewInstance ¶ added in v0.18.0
func (s ExponentialDistTable) NewInstance(_ *sql.Context, db sql.Database, args []sql.Expression) (sql.Node, error)
func (ExponentialDistTable) PartitionRows ¶ added in v0.18.0
PartitionRows is a sql.Table interface function that takes a partition and returns all rows in that partition. This table has a partition for just schema changes, one for just data changes, and one for both.
func (ExponentialDistTable) Partitions ¶ added in v0.18.0
func (s ExponentialDistTable) Partitions(ctx *sql.Context) (sql.PartitionIter, error)
Partitions is a sql.Table interface function that returns a partition of the data. This data has a single partition.
func (ExponentialDistTable) Resolved ¶ added in v0.18.0
func (s ExponentialDistTable) Resolved() bool
func (ExponentialDistTable) Schema ¶ added in v0.18.0
func (s ExponentialDistTable) Schema() sql.Schema
func (ExponentialDistTable) String ¶ added in v0.18.0
func (s ExponentialDistTable) String() string
func (ExponentialDistTable) UnderlyingTable ¶ added in v0.18.0
func (s ExponentialDistTable) UnderlyingTable() sql.Table
func (ExponentialDistTable) WithChildren ¶ added in v0.18.0
func (ExponentialDistTable) WithDatabase ¶ added in v0.18.0
func (ExponentialDistTable) WithExpressions ¶ added in v0.18.0
func (s ExponentialDistTable) WithExpressions(e ...sql.Expression) (sql.Node, error)
type ExpressionsIndex ¶
type ExpressionsIndex interface { sql.Index MemTable() *Table ColumnExpressions() []sql.Expression }
ExpressionsIndex is an index made out of one or more expressions (usually field expressions), linked to a Table.
type FilteredTable ¶ added in v0.10.0
type FilteredTable struct {
*Table
}
FilteredTable functionality in the Table type was disabled for a long period of time, and has developed major issues with the current analyzer logic. It's only used in the pushdown unit tests, and sql.FilteredTable should be considered unstable until this situation is fixed.
func NewFilteredTable ¶ added in v0.10.0
func NewFilteredTable(db MemoryDatabase, name string, schema sql.PrimaryKeySchema, fkColl *ForeignKeyCollection) *FilteredTable
func (*FilteredTable) Projections ¶ added in v0.12.0
func (t *FilteredTable) Projections() []string
Projections implements sql.ProjectedTable
func (*FilteredTable) WithFilters ¶ added in v0.10.0
func (t *FilteredTable) WithFilters(ctx *sql.Context, filters []sql.Expression) sql.Table
WithFilters implements the sql.FilteredTable interface.
func (*FilteredTable) WithProjections ¶ added in v0.12.0
func (t *FilteredTable) WithProjections(schema []string) sql.Table
WithProjections implements sql.ProjectedTable
type ForeignKeyCollection ¶ added in v0.12.0
type ForeignKeyCollection struct {
// contains filtered or unexported fields
}
ForeignKeyCollection is a shareable container for a collection of foreign keys.
func (*ForeignKeyCollection) AddFK ¶ added in v0.12.0
func (fkc *ForeignKeyCollection) AddFK(fk sql.ForeignKeyConstraint)
AddFK adds the given foreign key to the internal slice.
func (*ForeignKeyCollection) DropFK ¶ added in v0.12.0
func (fkc *ForeignKeyCollection) DropFK(fkName string) bool
DropFK removes the given foreign key from the internal slice. Returns true if the foreign key was found.
func (*ForeignKeyCollection) Keys ¶ added in v0.12.0
func (fkc *ForeignKeyCollection) Keys() []sql.ForeignKeyConstraint
Keys returns all of the foreign keys.
func (*ForeignKeyCollection) SetResolved ¶ added in v0.12.0
func (fkc *ForeignKeyCollection) SetResolved(fkName string) bool
SetResolved sets the given foreign key as being resolved.
type GlobalsMap ¶ added in v0.12.0
type GlobalsMap = map[string]interface{}
type HistoryDatabase ¶
type HistoryDatabase struct { *Database Revisions map[string]map[interface{}]sql.Table // contains filtered or unexported fields }
HistoryDatabase is a test-only VersionedDatabase implementation. It only supports exact lookups, not AS OF queries between two revisions. It's constructed just like its non-versioned sibling, but it can receive updates to particular tables via the AddTableAsOf method. Consecutive calls to AddTableAsOf with the same table must install new versions of the named table each time, with ascending version identifiers, for this to work.
func NewHistoryDatabase ¶
func NewHistoryDatabase(name string) *HistoryDatabase
func (*HistoryDatabase) AddTableAsOf ¶
func (db *HistoryDatabase) AddTableAsOf(name string, t sql.Table, asOf interface{})
Adds a table with an asOf revision key. The table given becomes the current version for the name given.
func (*HistoryDatabase) GetTableInsensitiveAsOf ¶
func (*HistoryDatabase) GetTableNamesAsOf ¶
func (db *HistoryDatabase) GetTableNamesAsOf(ctx *sql.Context, time interface{}) ([]string, error)
type Index ¶ added in v0.12.0
type Index struct { DB string // required for engine tests with driver DriverName string // required for engine tests with driver Tbl *Table // required for engine tests with driver TableName string Exprs []sql.Expression Name string Unique bool Spatial bool Fulltext bool CommentStr string PrefixLens []uint16 // contains filtered or unexported fields }
func (*Index) ColumnExpressionTypes ¶ added in v0.12.0
func (idx *Index) ColumnExpressionTypes() []sql.ColumnExpressionType
ColumnExpressionTypes implements the interface sql.Index.
func (*Index) ColumnExpressions ¶ added in v0.12.0
func (idx *Index) ColumnExpressions() []sql.Expression
func (*Index) Expressions ¶ added in v0.12.0
func (*Index) ExtendedColumnExpressionTypes ¶ added in v0.16.0
func (idx *Index) ExtendedColumnExpressionTypes() []sql.ColumnExpressionType
func (*Index) ExtendedExpressions ¶ added in v0.16.0
func (*Index) ExtendedExprs ¶ added in v0.18.0
func (idx *Index) ExtendedExprs() []sql.Expression
ExtendedExprs returns the same information as ExtendedExpressions, but in sql.Expression form.
func (*Index) FullTextKeyColumns ¶ added in v0.17.0
func (*Index) FullTextTableNames ¶ added in v0.17.0
func (*Index) HandledFilters ¶ added in v0.12.0
func (idx *Index) HandledFilters(filters []sql.Expression) []sql.Expression
func (*Index) IsFullText ¶ added in v0.17.0
func (*Index) IsGenerated ¶ added in v0.12.0
func (*Index) Order ¶ added in v0.12.0
func (idx *Index) Order() sql.IndexOrder
func (*Index) PrefixLengths ¶ added in v0.15.0
func (*Index) Reversible ¶ added in v0.16.0
type IndexValue ¶ added in v0.9.0
func DecodeIndexValue ¶ added in v0.9.0
func DecodeIndexValue(data []byte) (*IndexValue, error)
type IndexedTable ¶ added in v0.14.0
type IndexedTable struct { *Table Lookup sql.IndexLookup }
IndexedTable is a table that expects to return one or more partitions for range lookups.
func (*IndexedTable) LookupPartitions ¶ added in v0.14.0
func (t *IndexedTable) LookupPartitions(ctx *sql.Context, lookup sql.IndexLookup) (sql.PartitionIter, error)
func (*IndexedTable) PartitionRows ¶ added in v0.15.0
func (t *IndexedTable) PartitionRows(ctx *sql.Context, partition sql.Partition) (sql.RowIter, error)
PartitionRows implements the sql.PartitionRows interface.
type IntSequenceTable ¶ added in v0.15.0
type IntSequenceTable struct { Len int64 // contains filtered or unexported fields }
IntSequenceTable a simple table function that returns a sequence of integers.
func (IntSequenceTable) CheckPrivileges ¶ added in v0.15.0
func (s IntSequenceTable) CheckPrivileges(_ *sql.Context, _ sql.PrivilegedOperationChecker) bool
func (IntSequenceTable) Children ¶ added in v0.15.0
func (s IntSequenceTable) Children() []sql.Node
func (IntSequenceTable) Collation ¶ added in v0.17.0
func (IntSequenceTable) Collation() sql.CollationID
Collation implements the sql.Table interface.
func (IntSequenceTable) CollationCoercibility ¶ added in v0.15.0
func (IntSequenceTable) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
CollationCoercibility implements the interface sql.CollationCoercible.
func (IntSequenceTable) Database ¶ added in v0.15.0
func (s IntSequenceTable) Database() sql.Database
func (IntSequenceTable) DebugString ¶ added in v0.15.0
func (s IntSequenceTable) DebugString() string
func (IntSequenceTable) Description ¶ added in v0.15.0
func (s IntSequenceTable) Description() string
func (IntSequenceTable) Expressions ¶ added in v0.15.0
func (s IntSequenceTable) Expressions() []sql.Expression
func (IntSequenceTable) GetIndexes ¶ added in v0.17.0
func (IntSequenceTable) IndexedAccess ¶ added in v0.17.0
func (s IntSequenceTable) IndexedAccess(lookup sql.IndexLookup) sql.IndexedTable
func (IntSequenceTable) IsReadOnly ¶ added in v0.18.0
func (s IntSequenceTable) IsReadOnly() bool
func (IntSequenceTable) LookupPartitions ¶ added in v0.17.0
func (s IntSequenceTable) LookupPartitions(context *sql.Context, lookup sql.IndexLookup) (sql.PartitionIter, error)
LookupPartitions is a sql.IndexedTable interface function that takes an index lookup and returns the set of corresponding partitions.
func (IntSequenceTable) Name ¶ added in v0.15.0
func (s IntSequenceTable) Name() string
func (IntSequenceTable) NewInstance ¶ added in v0.15.0
func (s IntSequenceTable) NewInstance(_ *sql.Context, db sql.Database, args []sql.Expression) (sql.Node, error)
func (IntSequenceTable) PartitionRows ¶ added in v0.17.0
func (s IntSequenceTable) PartitionRows(ctx *sql.Context, partition sql.Partition) (sql.RowIter, error)
PartitionRows is a sql.Table interface function that takes a partition and returns all rows in that partition. This table has a partition for just schema changes, one for just data changes, and one for both.
func (IntSequenceTable) Partitions ¶ added in v0.17.0
func (s IntSequenceTable) Partitions(ctx *sql.Context) (sql.PartitionIter, error)
Partitions is a sql.Table interface function that returns a partition of the data. This data has a single partition.
func (IntSequenceTable) PreciseMatch ¶ added in v0.18.0
func (s IntSequenceTable) PreciseMatch() bool
func (IntSequenceTable) Resolved ¶ added in v0.15.0
func (s IntSequenceTable) Resolved() bool
func (IntSequenceTable) Schema ¶ added in v0.15.0
func (s IntSequenceTable) Schema() sql.Schema
func (IntSequenceTable) String ¶ added in v0.15.0
func (s IntSequenceTable) String() string
func (IntSequenceTable) UnderlyingTable ¶ added in v0.17.0
func (s IntSequenceTable) UnderlyingTable() sql.Table
func (IntSequenceTable) WithChildren ¶ added in v0.15.0
func (IntSequenceTable) WithDatabase ¶ added in v0.15.0
func (IntSequenceTable) WithExpressions ¶ added in v0.15.0
func (s IntSequenceTable) WithExpressions(e ...sql.Expression) (sql.Node, error)
type MemoryDatabase ¶ added in v0.11.0
type MemoryDatabase interface { sql.Database AddTable(name string, t MemTable) Database() *BaseDatabase }
type NormalDistTable ¶ added in v0.18.0
type NormalDistTable struct {
// contains filtered or unexported fields
}
NormalDistTable a simple table function that returns samples from a parameterized normal distribution.
func (NormalDistTable) CheckPrivileges ¶ added in v0.18.0
func (s NormalDistTable) CheckPrivileges(_ *sql.Context, _ sql.PrivilegedOperationChecker) bool
func (NormalDistTable) Children ¶ added in v0.18.0
func (s NormalDistTable) Children() []sql.Node
func (NormalDistTable) Collation ¶ added in v0.18.0
func (NormalDistTable) Collation() sql.CollationID
Collation implements the sql.Table interface.
func (NormalDistTable) CollationCoercibility ¶ added in v0.18.0
func (NormalDistTable) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
CollationCoercibility implements the interface sql.CollationCoercible.
func (NormalDistTable) Database ¶ added in v0.18.0
func (s NormalDistTable) Database() sql.Database
func (NormalDistTable) DebugString ¶ added in v0.18.0
func (s NormalDistTable) DebugString() string
func (NormalDistTable) Description ¶ added in v0.18.0
func (s NormalDistTable) Description() string
func (NormalDistTable) Expressions ¶ added in v0.18.0
func (s NormalDistTable) Expressions() []sql.Expression
func (NormalDistTable) IsReadOnly ¶ added in v0.18.0
func (s NormalDistTable) IsReadOnly() bool
func (NormalDistTable) Name ¶ added in v0.18.0
func (s NormalDistTable) Name() string
func (NormalDistTable) NewInstance ¶ added in v0.18.0
func (s NormalDistTable) NewInstance(_ *sql.Context, db sql.Database, args []sql.Expression) (sql.Node, error)
func (NormalDistTable) PartitionRows ¶ added in v0.18.0
PartitionRows is a sql.Table interface function that takes a partition and returns all rows in that partition. This table has a partition for just schema changes, one for just data changes, and one for both.
func (NormalDistTable) Partitions ¶ added in v0.18.0
func (s NormalDistTable) Partitions(ctx *sql.Context) (sql.PartitionIter, error)
Partitions is a sql.Table interface function that returns a partition of the data. This data has a single partition.
func (NormalDistTable) Resolved ¶ added in v0.18.0
func (s NormalDistTable) Resolved() bool
func (NormalDistTable) Schema ¶ added in v0.18.0
func (s NormalDistTable) Schema() sql.Schema
func (NormalDistTable) String ¶ added in v0.18.0
func (s NormalDistTable) String() string
func (NormalDistTable) UnderlyingTable ¶ added in v0.18.0
func (s NormalDistTable) UnderlyingTable() sql.Table
func (NormalDistTable) WithChildren ¶ added in v0.18.0
func (NormalDistTable) WithDatabase ¶ added in v0.18.0
func (NormalDistTable) WithExpressions ¶ added in v0.18.0
func (s NormalDistTable) WithExpressions(e ...sql.Expression) (sql.Node, error)
type Partition ¶ added in v0.9.0
type Partition struct {
// contains filtered or unexported fields
}
func NewPartition ¶ added in v0.9.0
type PointLookupTable ¶ added in v0.18.0
type PointLookupTable struct {
IntSequenceTable
}
PointLookupTable is a table whose indexes only support point lookups but not range scans. It's used for testing optimizations on indexes.
func (PointLookupTable) DebugString ¶ added in v0.18.0
func (s PointLookupTable) DebugString() string
func (PointLookupTable) Description ¶ added in v0.18.0
func (s PointLookupTable) Description() string
func (PointLookupTable) GetIndexes ¶ added in v0.18.0
func (PointLookupTable) Name ¶ added in v0.18.0
func (s PointLookupTable) Name() string
func (PointLookupTable) NewInstance ¶ added in v0.18.0
func (s PointLookupTable) NewInstance(ctx *sql.Context, db sql.Database, args []sql.Expression) (sql.Node, error)
func (PointLookupTable) PreciseMatch ¶ added in v0.18.0
func (s PointLookupTable) PreciseMatch() bool
func (PointLookupTable) String ¶ added in v0.18.0
func (s PointLookupTable) String() string
func (PointLookupTable) UnderlyingTable ¶ added in v0.18.0
func (s PointLookupTable) UnderlyingTable() sql.Table
type ProviderOption ¶ added in v0.15.0
type ProviderOption func(*DbProvider)
func HistoryProvider ¶ added in v0.15.0
func HistoryProvider(enableHistory bool) ProviderOption
HistoryProvider returns a ProviderOption to construct a memoryDBProvider that uses history databases
func NativeIndexProvider ¶ added in v0.15.0
func NativeIndexProvider(useNativeIndexes bool) ProviderOption
func ReadOnlyProvider ¶ added in v0.15.0
func ReadOnlyProvider(enableReadOnly bool) ProviderOption
ReadOnlyProvider returns a ProviderOption to construct a memoryDBProvider that is read-only
func WithDbsOption ¶ added in v0.15.0
func WithDbsOption(dbs []sql.Database) ProviderOption
WithDbsOption returns a ProviderOption to construct a DbProvider with the given databases
type ReadOnlyDatabase ¶ added in v0.11.0
type ReadOnlyDatabase struct {
*HistoryDatabase
}
func NewReadOnlyDatabase ¶ added in v0.11.0
func NewReadOnlyDatabase(name string) ReadOnlyDatabase
func (ReadOnlyDatabase) IsReadOnly ¶ added in v0.11.0
func (d ReadOnlyDatabase) IsReadOnly() bool
type RequiredLookupTable ¶ added in v0.18.0
type RequiredLookupTable struct { IntSequenceTable // contains filtered or unexported fields }
RequiredLookupTable is a table that will error if not executed as an index lookup
func (RequiredLookupTable) Database ¶ added in v0.18.0
func (s RequiredLookupTable) Database() sql.Database
func (RequiredLookupTable) DebugString ¶ added in v0.18.0
func (s RequiredLookupTable) DebugString() string
func (RequiredLookupTable) Description ¶ added in v0.18.0
func (s RequiredLookupTable) Description() string
func (RequiredLookupTable) Expressions ¶ added in v0.18.0
func (s RequiredLookupTable) Expressions() []sql.Expression
func (RequiredLookupTable) GetIndexes ¶ added in v0.18.0
func (RequiredLookupTable) IndexedAccess ¶ added in v0.18.0
func (s RequiredLookupTable) IndexedAccess(lookup sql.IndexLookup) sql.IndexedTable
func (RequiredLookupTable) Name ¶ added in v0.18.0
func (s RequiredLookupTable) Name() string
func (RequiredLookupTable) NewInstance ¶ added in v0.18.0
func (s RequiredLookupTable) NewInstance(ctx *sql.Context, db sql.Database, args []sql.Expression) (sql.Node, error)
func (RequiredLookupTable) PartitionRows ¶ added in v0.18.0
func (RequiredLookupTable) Partitions ¶ added in v0.18.0
func (s RequiredLookupTable) Partitions(ctx *sql.Context) (sql.PartitionIter, error)
Partitions is a sql.Table interface function that returns a partition of the data. This data has a single partition.
func (RequiredLookupTable) PreciseMatch ¶ added in v0.18.0
func (s RequiredLookupTable) PreciseMatch() bool
func (RequiredLookupTable) RequiredPredicates ¶ added in v0.18.0
func (s RequiredLookupTable) RequiredPredicates() []string
func (RequiredLookupTable) String ¶ added in v0.18.0
func (s RequiredLookupTable) String() string
func (RequiredLookupTable) UnderlyingTable ¶ added in v0.18.0
func (s RequiredLookupTable) UnderlyingTable() sql.Table
func (RequiredLookupTable) WithChildren ¶ added in v0.18.0
func (RequiredLookupTable) WithDatabase ¶ added in v0.18.0
func (RequiredLookupTable) WithExpressions ¶ added in v0.18.0
func (s RequiredLookupTable) WithExpressions(e ...sql.Expression) (sql.Node, error)
type SequenceTableFnRowIter ¶ added in v0.15.0
type SequenceTableFnRowIter struct {
// contains filtered or unexported fields
}
type Session ¶ added in v0.18.0
type Session struct { *sql.BaseSession // contains filtered or unexported fields }
func NewSession ¶ added in v0.18.0
func NewSession(baseSession *sql.BaseSession, provider sql.DatabaseProvider) *Session
NewSession returns the new session for this object
func SessionFromContext ¶ added in v0.18.0
func (*Session) CommitTransaction ¶ added in v0.18.0
func (*Session) CreateSavepoint ¶ added in v0.18.0
func (*Session) GetPersistedValue ¶ added in v0.18.0
GetPersistedValue implements sql.PersistableSession
func (*Session) PersistGlobal ¶ added in v0.18.0
PersistGlobal implements sql.PersistableSession
func (*Session) ReleaseSavepoint ¶ added in v0.18.0
func (*Session) RemoveAllPersistedGlobals ¶ added in v0.18.0
RemoveAllPersistedGlobals implements sql.PersistableSession
func (*Session) RemovePersistedGlobal ¶ added in v0.18.0
RemovePersistedGlobal implements sql.PersistableSession
func (*Session) RollbackToSavepoint ¶ added in v0.18.0
func (*Session) SetGlobals ¶ added in v0.18.0
func (*Session) SetValidationCallback ¶ added in v0.18.0
func (*Session) StartTransaction ¶ added in v0.18.0
func (s *Session) StartTransaction(ctx *sql.Context, tCharacteristic sql.TransactionCharacteristic) (sql.Transaction, error)
StartTransaction clears session state and returns a new transaction object. Because we don't support concurrency, we store table data changes in the session, rather than the transaction itself.
type StatsProv ¶ added in v0.18.0
type StatsProv struct {
// contains filtered or unexported fields
}
func NewStatsProv ¶ added in v0.18.0
func NewStatsProv() *StatsProv
func (*StatsProv) DataLength ¶ added in v0.18.0
func (*StatsProv) DropDbStats ¶ added in v0.18.0
func (*StatsProv) GetTableStats ¶ added in v0.18.0
func (*StatsProv) RefreshTableStats ¶ added in v0.18.0
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table represents an in-memory database table.
func NewDualTable ¶ added in v0.18.0
func NewDualTable() *Table
NewDualTable creates the dual table, which is used by the engine for queries with no tables specified, or the `dual` table specified. This table is never supplied by integrators, but always by this stand-in implementation.
func NewLocalTable ¶ added in v0.18.0
func NewLocalTable(db MemoryDatabase, name string, schema sql.PrimaryKeySchema, fkColl *ForeignKeyCollection) *Table
NewLocalTable returns a table suitable to use for transient non-memory applications
func NewPartitionedTable ¶
func NewPartitionedTable(db *BaseDatabase, name string, schema sql.PrimaryKeySchema, fkColl *ForeignKeyCollection, numPartitions int) *Table
NewPartitionedTable creates a new Table with the given name, schema and number of partitions. Assigns the default collation, therefore if a different collation is desired, please use NewPartitionedTableWithCollation.
func NewPartitionedTableWithCollation ¶ added in v0.14.0
func NewPartitionedTableWithCollation(db *BaseDatabase, name string, schema sql.PrimaryKeySchema, fkColl *ForeignKeyCollection, numPartitions int, collation sql.CollationID, comment string) *Table
NewPartitionedTableWithCollation creates a new Table with the given name, schema, number of partitions, collation, and comment.
func NewTable ¶
func NewTable(db MemoryDatabase, name string, schema sql.PrimaryKeySchema, fkColl *ForeignKeyCollection) *Table
NewTable creates a new Table with the given name and schema. Assigns the default collation, therefore if a different collation is desired, please use NewTableWithCollation.
func NewTableWithCollation ¶ added in v0.14.0
func NewTableWithCollation(db *BaseDatabase, name string, schema sql.PrimaryKeySchema, fkColl *ForeignKeyCollection, collation sql.CollationID) *Table
NewTableWithCollation creates a new Table with the given name, schema, and collation.
func (*Table) AddForeignKey ¶ added in v0.12.0
AddForeignKey implements sql.ForeignKeyTable. Foreign partitionKeys are not enforced on update / delete.
func (*Table) AutoIncrementSetter ¶
func (t *Table) AutoIncrementSetter(ctx *sql.Context) sql.AutoIncrementSetter
func (*Table) BuildIndex ¶ added in v0.18.0
func (*Table) Collation ¶ added in v0.14.0
func (t *Table) Collation() sql.CollationID
Collation implements the sql.Table interface.
func (*Table) CreateCheck ¶ added in v0.9.0
CreateCheck implements sql.CheckAlterableTable
func (*Table) CreateFulltextIndex ¶ added in v0.17.0
func (t *Table) CreateFulltextIndex(ctx *sql.Context, indexDef sql.IndexDef, keyCols fulltext.KeyColumns, tableNames fulltext.IndexTableNames) error
CreateFulltextIndex implements fulltext.IndexAlterableTable
func (*Table) CreateIndex ¶
CreateIndex implements sql.IndexAlterableTable
func (*Table) CreateIndexForForeignKey ¶ added in v0.12.0
CreateIndexForForeignKey implements sql.ForeignKeyTable.
func (*Table) CreatePrimaryKey ¶ added in v0.11.0
CreatePrimaryKey implements the PrimaryKeyAlterableTable
func (*Table) DataLength ¶ added in v0.9.0
func (*Table) DebugString ¶
func (*Table) DropForeignKey ¶
DropForeignKey implements sql.ForeignKeyTable.
func (*Table) DropPrimaryKey ¶ added in v0.11.0
DropPrimaryKey implements the PrimaryKeyAlterableTable TODO: get rid of this / make it error?
func (*Table) EnablePrimaryKeyIndexes ¶
func (t *Table) EnablePrimaryKeyIndexes()
EnablePrimaryKeyIndexes enables the use of primary key indexes on this table.
func (*Table) Filters ¶ added in v0.10.0
func (t *Table) Filters() []sql.Expression
Filters implements the sql.FilteredTable interface.
func (*Table) GetDeclaredForeignKeys ¶ added in v0.12.0
GetDeclaredForeignKeys implements the interface sql.ForeignKeyTable.
func (*Table) GetForeignKeyEditor ¶ added in v0.15.0
func (t *Table) GetForeignKeyEditor(ctx *sql.Context) sql.ForeignKeyEditor
GetForeignKeyEditor implements sql.ForeignKeyTable.
func (*Table) GetIndexes ¶
GetIndexes implements sql.IndexedTable
func (*Table) GetNextAutoIncrementValue ¶ added in v0.11.0
GetNextAutoIncrementValue gets the next auto increment value for the memory table the increment.
func (*Table) GetReferencedForeignKeys ¶ added in v0.12.0
GetReferencedForeignKeys implements the interface sql.ForeignKeyTable.
func (*Table) HandledFilters ¶
func (t *Table) HandledFilters(filters []sql.Expression) []sql.Expression
HandledFilters implements the sql.FilteredTable interface.
func (*Table) IgnoreSessionData ¶ added in v0.18.0
func (*Table) IndexedAccess ¶ added in v0.14.0
func (t *Table) IndexedAccess(lookup sql.IndexLookup) sql.IndexedTable
func (*Table) Insert ¶
Insert is a convenience method to avoid having to create an inserter in test setup
func (*Table) ModifyColumn ¶
func (*Table) ModifyDefaultCollation ¶ added in v0.15.0
ModifyDefaultCollation implements sql.CollationAlterableTable
func (*Table) ModifyStoredCollation ¶ added in v0.15.0
ModifyStoredCollation implements sql.CollationAlterableTable
func (*Table) PartitionCount ¶
PartitionCount implements the sql.PartitionCounter interface.
func (*Table) PartitionRows ¶
PartitionRows implements the sql.PartitionRows interface.
func (*Table) Partitions ¶
Partitions implements the sql.Table interface.
func (*Table) PeekNextAutoIncrementValue ¶ added in v0.11.0
PeekNextAutoIncrementValue peeks at the next AUTO_INCREMENT value
func (*Table) PreciseMatch ¶ added in v0.18.0
func (*Table) PrimaryKeySchema ¶ added in v0.12.0
func (t *Table) PrimaryKeySchema() sql.PrimaryKeySchema
PrimaryKeySchema implements sql.PrimaryKeyAlterableTable
func (*Table) Projections ¶ added in v0.12.0
Projections implements sql.ProjectedTable
func (*Table) RenameIndex ¶
RenameIndex implements sql.IndexAlterableTable
func (*Table) RewriteInserter ¶ added in v0.18.0
func (t *Table) RewriteInserter(ctx *sql.Context, oldSchema, newSchema sql.PrimaryKeySchema, _, _ *sql.Column, idxCols []sql.IndexColumn) (sql.RowInserter, error)
func (*Table) SetForeignKeyResolved ¶ added in v0.12.0
SetForeignKeyResolved implements sql.ForeignKeyTable.
func (*Table) ShouldBuildIndex ¶ added in v0.18.0
func (*Table) ShouldRewriteTable ¶ added in v0.18.0
func (*Table) UnderlyingTable ¶ added in v0.18.0
func (*Table) UpdateForeignKey ¶ added in v0.12.0
func (t *Table) UpdateForeignKey(ctx *sql.Context, fkName string, fk sql.ForeignKeyConstraint) error
UpdateForeignKey implements sql.ForeignKeyTable.
type TableData ¶ added in v0.18.0
type TableData struct {
// contains filtered or unexported fields
}
TableData encapsulates all schema and data for a table's schema and rows. Other aspects of a table can change freely as needed for different views on a table (column projections, index lookups, filters, etc.) but the storage of underlying data lives here.
func (TableData) Table ¶ added in v0.18.0
func (td TableData) Table(database *BaseDatabase) *Table
Table returns a table with this data
type TableFunc ¶ added in v0.18.0
type TableFunc struct {
// contains filtered or unexported fields
}
TableFunc a simple table function that returns the instantiated value.
func (TableFunc) CheckPrivileges ¶ added in v0.18.0
func (TableFunc) Collation ¶ added in v0.18.0
func (TableFunc) Collation() sql.CollationID
Collation implements the sql.Table interface.
func (TableFunc) CollationCoercibility ¶ added in v0.18.0
func (TableFunc) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)
CollationCoercibility implements the interface sql.CollationCoercible.
func (TableFunc) DebugString ¶ added in v0.18.0
func (TableFunc) Description ¶ added in v0.18.0
func (TableFunc) Expressions ¶ added in v0.18.0
func (s TableFunc) Expressions() []sql.Expression
func (TableFunc) IsReadOnly ¶ added in v0.18.0
func (TableFunc) NewInstance ¶ added in v0.18.0
func (TableFunc) WithChildren ¶ added in v0.18.0
func (TableFunc) WithDatabase ¶ added in v0.18.0
func (TableFunc) WithExpressions ¶ added in v0.18.0
type TableFunctionRowIter ¶ added in v0.18.0
type TableFunctionRowIter struct {
// contains filtered or unexported fields
}
type TableRevision ¶ added in v0.18.0
type TableRevision struct {
*Table
}
TableRevision is a container for memory tables to run basic smoke tests for versioned queries. It overrides only enough of the Table interface required to pass those tests. Memory tables have a flag to force them to ignore session data and use embedded data, which is required for the versioned table tests to pass.
func NewPartitionedTableRevision ¶ added in v0.18.0
func NewPartitionedTableRevision(db *BaseDatabase, name string, schema sql.PrimaryKeySchema, fkColl *ForeignKeyCollection, numPartitions int) *TableRevision
NewPartitionedTable creates a new Table with the given name, schema and number of partitions. Assigns the default collation, therefore if a different collation is desired, please use NewPartitionedTableWithCollation.
func (*TableRevision) AddColumn ¶ added in v0.18.0
func (t *TableRevision) AddColumn(ctx *sql.Context, column *sql.Column, order *sql.ColumnOrder) error
func (*TableRevision) IgnoreSessionData ¶ added in v0.18.0
func (t *TableRevision) IgnoreSessionData() bool
func (*TableRevision) Inserter ¶ added in v0.18.0
func (t *TableRevision) Inserter(ctx *sql.Context) sql.RowInserter
type TestIndexDriver ¶
type TestIndexDriver struct {
// contains filtered or unexported fields
}
TestIndexDriver is a non-performant index driver meant to aid in verification of engine correctness. It can not create or delete indexes, but will use the index types defined in this package to alter how queries are executed, retrieving values from the indexes rather than from the tables directly.
func NewIndexDriver ¶
func NewIndexDriver(db string, indexes map[string][]sql.DriverIndex) *TestIndexDriver
NewIndexDriver returns a new index driver for database and the indexes given, keyed by the table name.
func (*TestIndexDriver) Create ¶
func (d *TestIndexDriver) Create(db, table, id string, expressions []sql.Expression, config map[string]string) (sql.DriverIndex, error)
func (*TestIndexDriver) Delete ¶
func (d *TestIndexDriver) Delete(sql.DriverIndex, sql.PartitionIter) error
func (*TestIndexDriver) ID ¶
func (d *TestIndexDriver) ID() string
func (*TestIndexDriver) LoadAll ¶
func (d *TestIndexDriver) LoadAll(ctx *sql.Context, db, table string) ([]sql.DriverIndex, error)
func (*TestIndexDriver) Save ¶
func (d *TestIndexDriver) Save(*sql.Context, sql.DriverIndex, sql.PartitionIndexKeyValueIter) error
type Transaction ¶ added in v0.18.0
type Transaction struct {
// contains filtered or unexported fields
}
func (*Transaction) IsReadOnly ¶ added in v0.18.0
func (s *Transaction) IsReadOnly() bool
func (*Transaction) String ¶ added in v0.18.0
func (s *Transaction) String() string
Source Files
¶
- database.go
- dual_table.go
- exponential_dist_table.go
- external_stored_procedures.go
- foreign_key_collection.go
- index.go
- index_driver.go
- normal_dist_table.go
- point_lookup_table.go
- provider.go
- required_lookup_table.go
- sequence_table.go
- session.go
- stats.go
- table.go
- table_data.go
- table_editor.go
- table_function.go