Documentation ¶
Index ¶
- Constants
- func EncodeIndexValue(value *IndexValue) ([]byte, error)
- func NewMemoryDBProvider(dbs ...sql.Database) sql.MutableDatabaseProvider
- type AscendIndexLookup
- func (l *AscendIndexLookup) EvalExpression() sql.Expression
- func (l *AscendIndexLookup) ID() string
- func (l *AscendIndexLookup) Indexes() []string
- func (l *AscendIndexLookup) Intersection(lookups ...sql.IndexLookup) (sql.IndexLookup, error)
- func (l *AscendIndexLookup) IsMergeable(lookup sql.IndexLookup) bool
- func (l *AscendIndexLookup) String() string
- func (l *AscendIndexLookup) Union(lookups ...sql.IndexLookup) (sql.IndexLookup, error)
- func (l *AscendIndexLookup) Values(p sql.Partition) (sql.IndexValueIter, error)
- type BaseDatabase
- func (d *BaseDatabase) AddTable(name string, t sql.Table)
- func (d *BaseDatabase) CreateTable(ctx *sql.Context, name string, schema sql.Schema) error
- func (d *BaseDatabase) CreateTrigger(ctx *sql.Context, definition sql.TriggerDefinition) 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(ctx *sql.Context, name string) error
- func (d *BaseDatabase) EnablePrimaryKeyIndexes()
- 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(ctx *sql.Context) ([]sql.TriggerDefinition, error)
- func (d *BaseDatabase) Name() string
- func (d *BaseDatabase) RenameTable(ctx *sql.Context, oldName, newName string) error
- func (d *BaseDatabase) SaveStoredProcedure(ctx *sql.Context, spd sql.StoredProcedureDetails) error
- func (d *BaseDatabase) Tables() map[string]sql.Table
- type Database
- func (d *Database) AllViews(ctx *sql.Context) ([]sql.ViewDefinition, error)
- func (d *Database) CreateView(ctx *sql.Context, name string, selectStatement string) error
- func (d *Database) DropView(ctx *sql.Context, name string) error
- func (d *Database) GetView(ctx *sql.Context, viewName string) (string, bool, error)
- type DescendIndexLookup
- func (l *DescendIndexLookup) EvalExpression() sql.Expression
- func (l *DescendIndexLookup) ID() string
- func (l *DescendIndexLookup) Indexes() []string
- func (l *DescendIndexLookup) Intersection(lookups ...sql.IndexLookup) (sql.IndexLookup, error)
- func (l *DescendIndexLookup) IsMergeable(lookup sql.IndexLookup) bool
- func (l *DescendIndexLookup) String() string
- func (l *DescendIndexLookup) Union(lookups ...sql.IndexLookup) (sql.IndexLookup, error)
- func (l *DescendIndexLookup) Values(p sql.Partition) (sql.IndexValueIter, error)
- type ExpressionsIndex
- type FilteredTable
- 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 IndexValue
- type MemoryDatabase
- type MergeableIndex
- func (i *MergeableIndex) AscendGreaterOrEqual(keys ...interface{}) (sql.IndexLookup, error)
- func (i *MergeableIndex) AscendLessThan(keys ...interface{}) (sql.IndexLookup, error)
- func (i *MergeableIndex) AscendRange(greaterOrEqual, lessThan []interface{}) (sql.IndexLookup, error)
- func (i *MergeableIndex) ColumnExpressions() []sql.Expression
- func (i *MergeableIndex) Comment() string
- func (i *MergeableIndex) Database() string
- func (i *MergeableIndex) DescendGreater(keys ...interface{}) (sql.IndexLookup, error)
- func (i *MergeableIndex) DescendLessOrEqual(keys ...interface{}) (sql.IndexLookup, error)
- func (i *MergeableIndex) DescendRange(lessOrEqual, greaterThan []interface{}) (sql.IndexLookup, error)
- func (i *MergeableIndex) Driver() string
- func (i *MergeableIndex) Expressions() []string
- func (i *MergeableIndex) Get(key ...interface{}) (sql.IndexLookup, error)
- func (i *MergeableIndex) Has(sql.Partition, ...interface{}) (bool, error)
- func (i *MergeableIndex) ID() string
- func (i *MergeableIndex) IndexType() string
- func (i *MergeableIndex) IsGenerated() bool
- func (i *MergeableIndex) IsUnique() bool
- func (i *MergeableIndex) MemTable() *Table
- func (i *MergeableIndex) Not(keys ...interface{}) (sql.IndexLookup, error)
- func (i *MergeableIndex) Table() string
- type MergeableIndexLookup
- func (i *MergeableIndexLookup) EvalExpression() sql.Expression
- func (i *MergeableIndexLookup) ID() string
- func (i *MergeableIndexLookup) Indexes() []string
- func (i *MergeableIndexLookup) Intersection(lookups ...sql.IndexLookup) (sql.IndexLookup, error)
- func (i *MergeableIndexLookup) IsMergeable(lookup sql.IndexLookup) bool
- func (i *MergeableIndexLookup) String() string
- func (i *MergeableIndexLookup) Union(lookups ...sql.IndexLookup) (sql.IndexLookup, error)
- func (i *MergeableIndexLookup) Values(p sql.Partition) (sql.IndexValueIter, error)
- type MergeableLookup
- type MergedIndexLookup
- func (m *MergedIndexLookup) EvalExpression() sql.Expression
- func (m *MergedIndexLookup) ID() string
- func (m *MergedIndexLookup) Indexes() []string
- func (m *MergedIndexLookup) Intersection(lookups ...sql.IndexLookup) (sql.IndexLookup, error)
- func (m *MergedIndexLookup) IsMergeable(lookup sql.IndexLookup) bool
- func (m *MergedIndexLookup) String() string
- func (m *MergedIndexLookup) Union(lookups ...sql.IndexLookup) (sql.IndexLookup, error)
- func (m *MergedIndexLookup) Values(p sql.Partition) (sql.IndexValueIter, error)
- type NegateIndexLookup
- func (l *NegateIndexLookup) EvalExpression() sql.Expression
- func (l *NegateIndexLookup) ID() string
- func (l *NegateIndexLookup) Indexes() []string
- func (l *NegateIndexLookup) Intersection(indexes ...sql.IndexLookup) (sql.IndexLookup, error)
- func (*NegateIndexLookup) IsMergeable(lookup sql.IndexLookup) bool
- func (l *NegateIndexLookup) String() string
- func (l *NegateIndexLookup) Union(lookups ...sql.IndexLookup) (sql.IndexLookup, error)
- func (l *NegateIndexLookup) Values(p sql.Partition) (sql.IndexValueIter, error)
- type Partition
- type ReadOnlyDatabase
- type Table
- func (t *Table) AddColumn(ctx *sql.Context, column *sql.Column, order *sql.ColumnOrder) error
- func (t *Table) AutoIncrementSetter(*sql.Context) sql.AutoIncrementSetter
- func (t *Table) CreateCheck(_ *sql.Context, check *sql.CheckDefinition) error
- func (t *Table) CreateForeignKey(_ *sql.Context, fkName string, columns []string, referencedTable string, ...) error
- func (t *Table) CreateIndex(ctx *sql.Context, indexName string, using sql.IndexUsing, ...) error
- func (t *Table) CreatePrimaryKey(ctx *sql.Context, columns []sql.IndexColumn) error
- func (t *Table) DataLength(ctx *sql.Context) (uint64, error)
- func (t *Table) DebugString() string
- func (t *Table) Deleter(*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, indexName string) error
- func (t *Table) DropPrimaryKey(ctx *sql.Context) error
- func (t *Table) EnablePrimaryKeyIndexes()
- func (t *Table) Filters() []sql.Expression
- func (t *Table) GetChecks(_ *sql.Context) ([]sql.CheckDefinition, error)
- func (t *Table) GetForeignKeys(_ *sql.Context) ([]sql.ForeignKeyConstraint, error)
- func (t *Table) GetIndexes(ctx *sql.Context) ([]sql.Index, error)
- func (t *Table) GetNextAutoIncrementValue(ctx *sql.Context, insertVal interface{}) (interface{}, error)
- func (t *Table) GetPartition(key string) []sql.Row
- func (t *Table) HandledFilters(filters []sql.Expression) []sql.Expression
- func (t *Table) IndexKeyValues(ctx *sql.Context, colNames []string) (sql.PartitionIndexKeyValueIter, error)
- func (t *Table) Insert(ctx *sql.Context, row sql.Row) error
- func (t *Table) Inserter(*sql.Context) sql.RowInserter
- func (t *Table) ModifyColumn(ctx *sql.Context, columnName string, column *sql.Column, ...) error
- func (t *Table) Name() string
- func (t *Table) NumRows(ctx *sql.Context) (uint64, error)
- 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(*sql.Context) (interface{}, error)
- func (t *Table) RenameIndex(ctx *sql.Context, fromIndexName string, toIndexName string) error
- func (t *Table) Replacer(*sql.Context) sql.RowReplacer
- func (t *Table) Schema() sql.Schema
- func (t *Table) String() string
- func (t *Table) Truncate(ctx *sql.Context) (int, error)
- func (t *Table) Updater(*sql.Context) sql.RowUpdater
- func (t *Table) WithIndexLookup(lookup sql.IndexLookup) sql.Table
- func (t *Table) WithProjection(colNames []string) sql.Table
- 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 UnmergeableIndex
- type UnmergeableIndexLookup
- func (u *UnmergeableIndexLookup) Indexes() []string
- func (u *UnmergeableIndexLookup) Intersection(_ ...sql.IndexLookup) (sql.IndexLookup, error)
- func (u *UnmergeableIndexLookup) IsMergeable(_ sql.IndexLookup) bool
- func (u *UnmergeableIndexLookup) String() string
- func (u *UnmergeableIndexLookup) Union(_ ...sql.IndexLookup) (sql.IndexLookup, error)
- func (u *UnmergeableIndexLookup) Values(p sql.Partition) (sql.IndexValueIter, error)
Constants ¶
const IndexDriverId = "MemoryIndexDriver"
Variables ¶
This section is empty.
Functions ¶
func EncodeIndexValue ¶
func EncodeIndexValue(value *IndexValue) ([]byte, error)
func NewMemoryDBProvider ¶
func NewMemoryDBProvider(dbs ...sql.Database) sql.MutableDatabaseProvider
Types ¶
type AscendIndexLookup ¶
type AscendIndexLookup struct { Gte []interface{} Lt []interface{} Index ExpressionsIndex // contains filtered or unexported fields }
func (*AscendIndexLookup) EvalExpression ¶
func (l *AscendIndexLookup) EvalExpression() sql.Expression
func (*AscendIndexLookup) ID ¶
func (l *AscendIndexLookup) ID() string
func (*AscendIndexLookup) Indexes ¶
func (l *AscendIndexLookup) Indexes() []string
func (*AscendIndexLookup) Intersection ¶
func (l *AscendIndexLookup) Intersection(lookups ...sql.IndexLookup) (sql.IndexLookup, error)
func (*AscendIndexLookup) IsMergeable ¶
func (l *AscendIndexLookup) IsMergeable(lookup sql.IndexLookup) bool
func (*AscendIndexLookup) String ¶
func (l *AscendIndexLookup) String() string
func (*AscendIndexLookup) Union ¶
func (l *AscendIndexLookup) Union(lookups ...sql.IndexLookup) (sql.IndexLookup, error)
func (*AscendIndexLookup) Values ¶
func (l *AscendIndexLookup) Values(p sql.Partition) (sql.IndexValueIter, error)
type BaseDatabase ¶
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 ¶
func NewViewlessDatabase(name string) *BaseDatabase
NewViewlessDatabase creates a new database that doesn't persist views. Used only for testing. Use NewDatabase.
func (*BaseDatabase) AddTable ¶
func (d *BaseDatabase) AddTable(name string, t sql.Table)
AddTable adds a new table to the database.
func (*BaseDatabase) CreateTable ¶
CreateTable creates a table with the given name and schema
func (*BaseDatabase) CreateTrigger ¶
func (d *BaseDatabase) CreateTrigger(ctx *sql.Context, definition sql.TriggerDefinition) error
func (*BaseDatabase) DropStoredProcedure ¶
func (d *BaseDatabase) DropStoredProcedure(ctx *sql.Context, name string) error
DropStoredProcedure implements sql.StoredProcedureDatabase
func (*BaseDatabase) DropTable ¶
func (d *BaseDatabase) DropTable(ctx *sql.Context, name string) error
DropTable drops the table with the given name
func (*BaseDatabase) DropTrigger ¶
func (d *BaseDatabase) DropTrigger(ctx *sql.Context, name string) error
func (*BaseDatabase) EnablePrimaryKeyIndexes ¶
func (d *BaseDatabase) EnablePrimaryKeyIndexes()
EnablePrimaryKeyIndexes causes every table created in this database to use an index on its primary keys
func (*BaseDatabase) GetStoredProcedures ¶
func (d *BaseDatabase) GetStoredProcedures(ctx *sql.Context) ([]sql.StoredProcedureDetails, error)
GetStoredProcedures implements sql.StoredProcedureDatabase
func (*BaseDatabase) GetTableInsensitive ¶
func (*BaseDatabase) GetTableNames ¶
func (d *BaseDatabase) GetTableNames(ctx *sql.Context) ([]string, error)
func (*BaseDatabase) GetTriggers ¶
func (d *BaseDatabase) GetTriggers(ctx *sql.Context) ([]sql.TriggerDefinition, error)
func (*BaseDatabase) RenameTable ¶
func (d *BaseDatabase) RenameTable(ctx *sql.Context, oldName, newName string) error
func (*BaseDatabase) SaveStoredProcedure ¶
func (d *BaseDatabase) SaveStoredProcedure(ctx *sql.Context, spd sql.StoredProcedureDetails) error
SaveStoredProcedure implements sql.StoredProcedureDatabase
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 ¶
type DescendIndexLookup ¶
type DescendIndexLookup struct { Gt []interface{} Lte []interface{} Index ExpressionsIndex // contains filtered or unexported fields }
func (*DescendIndexLookup) EvalExpression ¶
func (l *DescendIndexLookup) EvalExpression() sql.Expression
func (*DescendIndexLookup) ID ¶
func (l *DescendIndexLookup) ID() string
func (*DescendIndexLookup) Indexes ¶
func (l *DescendIndexLookup) Indexes() []string
func (*DescendIndexLookup) Intersection ¶
func (l *DescendIndexLookup) Intersection(lookups ...sql.IndexLookup) (sql.IndexLookup, error)
func (*DescendIndexLookup) IsMergeable ¶
func (l *DescendIndexLookup) IsMergeable(lookup sql.IndexLookup) bool
func (*DescendIndexLookup) String ¶
func (l *DescendIndexLookup) String() string
func (*DescendIndexLookup) Union ¶
func (l *DescendIndexLookup) Union(lookups ...sql.IndexLookup) (sql.IndexLookup, error)
func (*DescendIndexLookup) Values ¶
func (l *DescendIndexLookup) Values(p sql.Partition) (sql.IndexValueIter, error)
type ExpressionsIndex ¶
type ExpressionsIndex interface { 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 ¶
type FilteredTable struct {
*Table
}
sql.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 ¶
func NewFilteredTable(name string, schema sql.Schema) *FilteredTable
func (*FilteredTable) WithFilters ¶
func (t *FilteredTable) WithFilters(ctx *sql.Context, filters []sql.Expression) sql.Table
WithFilters implements the sql.FilteredTable interface.
func (*FilteredTable) WithProjection ¶
func (t *FilteredTable) WithProjection(colNames []string) sql.Table
WithFilters implements the sql.FilteredTable 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 IndexValue ¶
func DecodeIndexValue ¶
func DecodeIndexValue(data []byte) (*IndexValue, error)
type MemoryDatabase ¶
type MergeableIndex ¶
type MergeableIndex 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 CommentStr string }
func (*MergeableIndex) AscendGreaterOrEqual ¶
func (i *MergeableIndex) AscendGreaterOrEqual(keys ...interface{}) (sql.IndexLookup, error)
func (*MergeableIndex) AscendLessThan ¶
func (i *MergeableIndex) AscendLessThan(keys ...interface{}) (sql.IndexLookup, error)
func (*MergeableIndex) AscendRange ¶
func (i *MergeableIndex) AscendRange(greaterOrEqual, lessThan []interface{}) (sql.IndexLookup, error)
func (*MergeableIndex) ColumnExpressions ¶
func (i *MergeableIndex) ColumnExpressions() []sql.Expression
func (*MergeableIndex) Comment ¶
func (i *MergeableIndex) Comment() string
func (*MergeableIndex) Database ¶
func (i *MergeableIndex) Database() string
func (*MergeableIndex) DescendGreater ¶
func (i *MergeableIndex) DescendGreater(keys ...interface{}) (sql.IndexLookup, error)
func (*MergeableIndex) DescendLessOrEqual ¶
func (i *MergeableIndex) DescendLessOrEqual(keys ...interface{}) (sql.IndexLookup, error)
func (*MergeableIndex) DescendRange ¶
func (i *MergeableIndex) DescendRange(lessOrEqual, greaterThan []interface{}) (sql.IndexLookup, error)
func (*MergeableIndex) Driver ¶
func (i *MergeableIndex) Driver() string
func (*MergeableIndex) Expressions ¶
func (i *MergeableIndex) Expressions() []string
func (*MergeableIndex) Get ¶
func (i *MergeableIndex) Get(key ...interface{}) (sql.IndexLookup, error)
func (*MergeableIndex) Has ¶
func (i *MergeableIndex) Has(sql.Partition, ...interface{}) (bool, error)
func (*MergeableIndex) ID ¶
func (i *MergeableIndex) ID() string
func (*MergeableIndex) IndexType ¶
func (i *MergeableIndex) IndexType() string
func (*MergeableIndex) IsGenerated ¶
func (i *MergeableIndex) IsGenerated() bool
func (*MergeableIndex) IsUnique ¶
func (i *MergeableIndex) IsUnique() bool
func (*MergeableIndex) MemTable ¶
func (i *MergeableIndex) MemTable() *Table
func (*MergeableIndex) Not ¶
func (i *MergeableIndex) Not(keys ...interface{}) (sql.IndexLookup, error)
func (*MergeableIndex) Table ¶
func (i *MergeableIndex) Table() string
type MergeableIndexLookup ¶
type MergeableIndexLookup struct { Key []interface{} Index ExpressionsIndex }
MergeableIndexLookup is a lookup linked to an ExpressionsIndex. It can be merged with any other MergeableIndexLookup. All lookups in this package are Merge
func (*MergeableIndexLookup) EvalExpression ¶
func (i *MergeableIndexLookup) EvalExpression() sql.Expression
func (*MergeableIndexLookup) ID ¶
func (i *MergeableIndexLookup) ID() string
func (*MergeableIndexLookup) Indexes ¶
func (i *MergeableIndexLookup) Indexes() []string
func (*MergeableIndexLookup) Intersection ¶
func (i *MergeableIndexLookup) Intersection(lookups ...sql.IndexLookup) (sql.IndexLookup, error)
func (*MergeableIndexLookup) IsMergeable ¶
func (i *MergeableIndexLookup) IsMergeable(lookup sql.IndexLookup) bool
func (*MergeableIndexLookup) String ¶
func (i *MergeableIndexLookup) String() string
func (*MergeableIndexLookup) Union ¶
func (i *MergeableIndexLookup) Union(lookups ...sql.IndexLookup) (sql.IndexLookup, error)
func (*MergeableIndexLookup) Values ¶
func (i *MergeableIndexLookup) Values(p sql.Partition) (sql.IndexValueIter, error)
type MergeableLookup ¶
type MergeableLookup interface {
ID() string
}
All lookups in this package, except for UnmergeableLookup, are MergeableLookups. The IDs are mostly for testing / verification purposes.
type MergedIndexLookup ¶
type MergedIndexLookup struct { Unions []sql.IndexLookup Intersections []sql.IndexLookup Index ExpressionsIndex }
MergedIndexLookup is an index lookup that has been merged with another. Exactly one of the Unions or Intersections fields should be set, and correspond to a logical AND or OR operation, respectively.
func (*MergedIndexLookup) EvalExpression ¶
func (m *MergedIndexLookup) EvalExpression() sql.Expression
func (*MergedIndexLookup) ID ¶
func (m *MergedIndexLookup) ID() string
func (*MergedIndexLookup) Indexes ¶
func (m *MergedIndexLookup) Indexes() []string
func (*MergedIndexLookup) Intersection ¶
func (m *MergedIndexLookup) Intersection(lookups ...sql.IndexLookup) (sql.IndexLookup, error)
func (*MergedIndexLookup) IsMergeable ¶
func (m *MergedIndexLookup) IsMergeable(lookup sql.IndexLookup) bool
func (*MergedIndexLookup) String ¶
func (m *MergedIndexLookup) String() string
func (*MergedIndexLookup) Union ¶
func (m *MergedIndexLookup) Union(lookups ...sql.IndexLookup) (sql.IndexLookup, error)
func (*MergedIndexLookup) Values ¶
func (m *MergedIndexLookup) Values(p sql.Partition) (sql.IndexValueIter, error)
type NegateIndexLookup ¶
type NegateIndexLookup struct { Lookup MergeableLookup Index ExpressionsIndex }
func (*NegateIndexLookup) EvalExpression ¶
func (l *NegateIndexLookup) EvalExpression() sql.Expression
func (*NegateIndexLookup) ID ¶
func (l *NegateIndexLookup) ID() string
func (*NegateIndexLookup) Indexes ¶
func (l *NegateIndexLookup) Indexes() []string
func (*NegateIndexLookup) Intersection ¶
func (l *NegateIndexLookup) Intersection(indexes ...sql.IndexLookup) (sql.IndexLookup, error)
func (*NegateIndexLookup) IsMergeable ¶
func (*NegateIndexLookup) IsMergeable(lookup sql.IndexLookup) bool
func (*NegateIndexLookup) String ¶
func (l *NegateIndexLookup) String() string
func (*NegateIndexLookup) Union ¶
func (l *NegateIndexLookup) Union(lookups ...sql.IndexLookup) (sql.IndexLookup, error)
func (*NegateIndexLookup) Values ¶
func (l *NegateIndexLookup) Values(p sql.Partition) (sql.IndexValueIter, error)
type Partition ¶
type Partition struct {
// contains filtered or unexported fields
}
func NewPartition ¶
type ReadOnlyDatabase ¶
type ReadOnlyDatabase struct {
*HistoryDatabase
}
func NewReadOnlyDatabase ¶
func NewReadOnlyDatabase(name string) ReadOnlyDatabase
func (ReadOnlyDatabase) IsReadOnly ¶
func (d ReadOnlyDatabase) IsReadOnly() bool
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table represents an in-memory database table.
func NewPartitionedTable ¶
NewPartitionedTable creates a new Table with the given name, schema and number of partitions.
func (*Table) AutoIncrementSetter ¶
func (t *Table) AutoIncrementSetter(*sql.Context) sql.AutoIncrementSetter
func (*Table) CreateCheck ¶
CreateCheck implements sql.CheckAlterableTable
func (*Table) CreateForeignKey ¶
func (t *Table) CreateForeignKey(_ *sql.Context, fkName string, columns []string, referencedTable string, referencedColumns []string, onUpdate, onDelete sql.ForeignKeyReferenceOption) error
CreateForeignKey implements sql.ForeignKeyAlterableTable. Foreign keys are not enforced on update / delete.
func (*Table) CreateIndex ¶
func (t *Table) CreateIndex(ctx *sql.Context, indexName string, using sql.IndexUsing, constraint sql.IndexConstraint, columns []sql.IndexColumn, comment string) error
CreateIndex implements sql.IndexAlterableTable
func (*Table) CreatePrimaryKey ¶
CreatePrimaryKey implements the PrimaryKeyAlterableTable
func (*Table) DebugString ¶
func (*Table) DropCheck ¶
func (t *Table) DropCheck(ctx *sql.Context, chName string) error {} implements sql.CheckAlterableTable.
func (*Table) DropForeignKey ¶
DropForeignKey implements sql.ForeignKeyAlterableTable.
func (*Table) DropPrimaryKey ¶
DropPrimaryKey implements the PrimaryKeyAlterableTable
func (*Table) EnablePrimaryKeyIndexes ¶
func (t *Table) EnablePrimaryKeyIndexes()
EnablePrimaryKeyIndexes enables the use of primary key indexes on this table.
func (*Table) Filters ¶
func (t *Table) Filters() []sql.Expression
Filters implements the sql.FilteredTable interface.
func (*Table) GetForeignKeys ¶
GetForeignKeys implements sql.ForeignKeyTable
func (*Table) GetIndexes ¶
GetIndexes implements sql.IndexedTable
func (*Table) GetNextAutoIncrementValue ¶
func (t *Table) GetNextAutoIncrementValue(ctx *sql.Context, insertVal interface{}) (interface{}, error)
GetNextAutoIncrementValue gets the next auto increment value for the memory table the increment.
func (*Table) HandledFilters ¶
func (t *Table) HandledFilters(filters []sql.Expression) []sql.Expression
HandledFilters implements the sql.FilteredTable interface.
func (*Table) IndexKeyValues ¶
func (t *Table) IndexKeyValues( ctx *sql.Context, colNames []string, ) (sql.PartitionIndexKeyValueIter, error)
IndexKeyValues implements the sql.IndexableTable interface.
func (*Table) ModifyColumn ¶
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 ¶
PeekNextAutoIncrementValue peeks at the next AUTO_INCREMENT value
func (*Table) RenameIndex ¶
RenameIndex implements sql.IndexAlterableTable
func (*Table) WithIndexLookup ¶
func (t *Table) WithIndexLookup(lookup sql.IndexLookup) sql.Table
WithIndexLookup implements the sql.IndexAddressableTable interface.
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 UnmergeableIndex ¶
type UnmergeableIndex struct {
MergeableIndex
}
A very dumb index that iterates over the rows of a table, evaluates its matching expressions against each row, and stores those values to be later retrieved. Only here to test the functionality of indexed queries. This kind of index cannot be merged with any other index.
func (*UnmergeableIndex) Get ¶
func (u *UnmergeableIndex) Get(key ...interface{}) (sql.IndexLookup, error)
func (*UnmergeableIndex) Has ¶
func (u *UnmergeableIndex) Has(partition sql.Partition, key ...interface{}) (bool, error)
func (*UnmergeableIndex) Table ¶
func (u *UnmergeableIndex) Table() string
type UnmergeableIndexLookup ¶
type UnmergeableIndexLookup struct {
// contains filtered or unexported fields
}
UnmergeableIndexLookup is the only IndexLookup in this package that doesn't implement Mergeable, and therefore can't be merged with other lookups.
func (*UnmergeableIndexLookup) Indexes ¶
func (u *UnmergeableIndexLookup) Indexes() []string
func (*UnmergeableIndexLookup) Intersection ¶
func (u *UnmergeableIndexLookup) Intersection(_ ...sql.IndexLookup) (sql.IndexLookup, error)
func (*UnmergeableIndexLookup) IsMergeable ¶
func (u *UnmergeableIndexLookup) IsMergeable(_ sql.IndexLookup) bool
func (*UnmergeableIndexLookup) String ¶
func (u *UnmergeableIndexLookup) String() string
func (*UnmergeableIndexLookup) Union ¶
func (u *UnmergeableIndexLookup) Union(_ ...sql.IndexLookup) (sql.IndexLookup, error)
func (*UnmergeableIndexLookup) Values ¶
func (u *UnmergeableIndexLookup) Values(p sql.Partition) (sql.IndexValueIter, error)