core

package
v0.0.29 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2023 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const CommentPreventingIndexBuilding = "__FOR TESTING: I cannot be built__"
View Source
const IndexDriverId = "MemoryIndexDriver"

Variables

View Source
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,
		},
	}
)

Functions

func EncodeIndexValue

func EncodeIndexValue(value *IndexValue) ([]byte, error)

func NewDBProvider

func NewDBProvider(dbs ...sql.Database) sql.MutableDatabaseProvider

NewDBProvider creates a new DbProvider with the default options and the databases specified

func NewDBProviderWithOpts

func NewDBProviderWithOpts(opts ...ProviderOption) sql.MutableDatabaseProvider

NewDBProviderWithOpts creates a new DbProvider with the given options and no databases

func NewHistogramMapFromTable

func NewHistogramMapFromTable(ctx *sql.Context, t sql.Table) (sql.HistogramMap, error)

NewHistogramMapFromTable will construct a HistogramMap given a Table TODO: this is copied from the information_schema package, and should be moved to a more general location

func NewTableEditAccumulator

func NewTableEditAccumulator(t *Table) tableEditAccumulator

NewTableEditAccumulator returns a tableEditAccumulator based on the schema.

Types

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

func (d *BaseDatabase) CreateFulltextTableNames(ctx *sql.Context, parentTableName string, parentIndexName string) (fulltext.IndexTableNames, error)

func (*BaseDatabase) CreateIndexedTable

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

func (d *BaseDatabase) CreateTable(ctx *sql.Context, name string, schema sql.PrimaryKeySchema, collation sql.CollationID) error

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

func (d *BaseDatabase) DropEvent(ctx *sql.Context, name string) error

DropEvent implements sql.EventDatabase

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 partitionKeys

func (*BaseDatabase) GetCollation

func (d *BaseDatabase) GetCollation(ctx *sql.Context) sql.CollationID

GetCollation implements sql.CollatedDatabase.

func (*BaseDatabase) GetEvent

func (d *BaseDatabase) GetEvent(ctx *sql.Context, name string) (sql.EventDefinition, bool, error)

GetEvent implements sql.EventDatabase

func (*BaseDatabase) GetEvents

func (d *BaseDatabase) GetEvents(ctx *sql.Context) ([]sql.EventDefinition, error)

GetEvents implements sql.EventDatabase

func (*BaseDatabase) GetForeignKeyCollection

func (d *BaseDatabase) GetForeignKeyCollection() *ForeignKeyCollection

func (*BaseDatabase) GetStoredProcedure

func (d *BaseDatabase) GetStoredProcedure(ctx *sql.Context, name string) (sql.StoredProcedureDetails, bool, error)

GetStoredProcedure implements sql.StoredProcedureDatabase

func (*BaseDatabase) GetStoredProcedures

func (d *BaseDatabase) GetStoredProcedures(ctx *sql.Context) ([]sql.StoredProcedureDetails, error)

GetStoredProcedures implements sql.StoredProcedureDatabase

func (*BaseDatabase) GetTableInsensitive

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

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

func (d *BaseDatabase) Name() string

Name returns the database name.

func (*BaseDatabase) RenameTable

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

func (*BaseDatabase) SaveEvent

func (d *BaseDatabase) SaveEvent(ctx *sql.Context, ed sql.EventDefinition) error

SaveEvent implements sql.EventDatabase

func (*BaseDatabase) SaveStoredProcedure

func (d *BaseDatabase) SaveStoredProcedure(ctx *sql.Context, spd sql.StoredProcedureDetails) error

SaveStoredProcedure implements sql.StoredProcedureDatabase

func (*BaseDatabase) SetCollation

func (d *BaseDatabase) SetCollation(ctx *sql.Context, collation sql.CollationID) error

SetCollation implements sql.CollatedDatabase.

func (*BaseDatabase) Tables

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

Tables returns all tables in the database.

func (*BaseDatabase) UpdateEvent

func (d *BaseDatabase) UpdateEvent(ctx *sql.Context, originalName string, ed sql.EventDefinition) error

UpdateEvent implements sql.EventDatabase

type Database

type Database struct {
	*BaseDatabase
	// contains filtered or unexported fields
}

Database is an in-memory database.

func NewDatabase

func NewDatabase(name string) *Database

NewDatabase creates a new database with the given name.

func (*Database) AllViews

func (d *Database) AllViews(ctx *sql.Context) ([]sql.ViewDefinition, error)

AllViews implements the interface sql.ViewDatabase.

func (*Database) CreateView

func (d *Database) CreateView(ctx *sql.Context, name string, selectStatement, createViewStmt string) error

CreateView implements the interface sql.ViewDatabase.

func (*Database) DropView

func (d *Database) DropView(ctx *sql.Context, name string) error

DropView implements the interface sql.ViewDatabase.

func (*Database) GetViewDefinition

func (d *Database) GetViewDefinition(ctx *sql.Context, viewName string) (sql.ViewDefinition, bool, error)

GetViewDefinition implements the interface sql.ViewDatabase.

type DbProvider

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

DbProvider is a provider for in-memory databases

func (*DbProvider) AllDatabases

func (pro *DbProvider) AllDatabases(*sql.Context) []sql.Database

AllDatabases returns the Database with the given name if it exists.

func (*DbProvider) CreateDatabase

func (pro *DbProvider) CreateDatabase(_ *sql.Context, name string) (err error)

CreateDatabase implements MutableDatabaseProvider.

func (*DbProvider) Database

func (pro *DbProvider) Database(_ *sql.Context, name string) (sql.Database, error)

Database returns the Database with the given name if it exists.

func (*DbProvider) DropDatabase

func (pro *DbProvider) DropDatabase(_ *sql.Context, name string) (err error)

DropDatabase implements MutableDatabaseProvider.

func (*DbProvider) ExternalStoredProcedure

func (pro *DbProvider) ExternalStoredProcedure(_ *sql.Context, name string, numOfParams int) (*sql.ExternalStoredProcedureDetails, error)

ExternalStoredProcedure implements sql.ExternalStoredProcedureProvider

func (*DbProvider) ExternalStoredProcedures

func (pro *DbProvider) ExternalStoredProcedures(_ *sql.Context, name string) ([]sql.ExternalStoredProcedureDetails, error)

ExternalStoredProcedures implements sql.ExternalStoredProcedureProvider

func (*DbProvider) HasDatabase

func (pro *DbProvider) HasDatabase(_ *sql.Context, name string) bool

HasDatabase returns the Database with the given name if it exists.

func (*DbProvider) TableFunction

func (pro *DbProvider) TableFunction(_ *sql.Context, name string) (sql.TableFunction, error)

TableFunction implements sql.TableFunctionProvider

func (*DbProvider) WithOption

func (pro *DbProvider) WithOption(opt ProviderOption)

WithOption modifies the provider with the given option

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

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

func NewFilteredTable(name string, schema sql.PrimaryKeySchema, fkColl *ForeignKeyCollection) *FilteredTable

func (*FilteredTable) Projections

func (t *FilteredTable) Projections() []string

Projections implements sql.ProjectedTable

func (*FilteredTable) WithFilters

func (t *FilteredTable) WithFilters(ctx *sql.Context, filters []sql.Expression) sql.Table

WithFilters implements the sql.FilteredTable interface.

func (*FilteredTable) WithProjections

func (t *FilteredTable) WithProjections(schema []string) sql.Table

WithProjections implements sql.ProjectedTable

type ForeignKeyCollection

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

ForeignKeyCollection is a shareable container for a collection of foreign keys.

func (*ForeignKeyCollection) AddFK

AddFK adds the given foreign key to the internal slice.

func (*ForeignKeyCollection) DropFK

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

Keys returns all of the foreign keys.

func (*ForeignKeyCollection) SetResolved

func (fkc *ForeignKeyCollection) SetResolved(fkName string) bool

SetResolved sets the given foreign key as being resolved.

type GlobalsMap

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 (db *HistoryDatabase) GetTableInsensitiveAsOf(ctx *sql.Context, tblName string, time interface{}) (sql.Table, bool, error)

func (*HistoryDatabase) GetTableNamesAsOf

func (db *HistoryDatabase) GetTableNamesAsOf(ctx *sql.Context, time interface{}) ([]string, error)

type InMemoryPersistedSession

type InMemoryPersistedSession struct {
	sql.Session
	// contains filtered or unexported fields
}

func NewInMemoryPersistedSession

func NewInMemoryPersistedSession(sess sql.Session, persistedGlobals GlobalsMap) *InMemoryPersistedSession

NewInMemoryPersistedSession is a sql.PersistableSession that writes global variables to an im-memory map

func NewInMemoryPersistedSessionWithValidationCallback

func NewInMemoryPersistedSessionWithValidationCallback(sess sql.Session, validateCb func()) *InMemoryPersistedSession

NewInMemoryPersistedSessionWithValidationCallback is a sql.PersistableSession that defines increment function to count number of calls on ValidateSession().

func (*InMemoryPersistedSession) GetPersistedValue

func (s *InMemoryPersistedSession) GetPersistedValue(k string) (interface{}, error)

GetPersistedValue implements sql.PersistableSession

func (*InMemoryPersistedSession) PersistGlobal

func (s *InMemoryPersistedSession) PersistGlobal(sysVarName string, value interface{}) error

PersistGlobal implements sql.PersistableSession

func (*InMemoryPersistedSession) RemoveAllPersistedGlobals

func (s *InMemoryPersistedSession) RemoveAllPersistedGlobals() error

RemoveAllPersistedGlobals implements sql.PersistableSession

func (*InMemoryPersistedSession) RemovePersistedGlobal

func (s *InMemoryPersistedSession) RemovePersistedGlobal(sysVarName string) error

RemovePersistedGlobal implements sql.PersistableSession

func (*InMemoryPersistedSession) ValidateSession

func (s *InMemoryPersistedSession) ValidateSession(ctx *sql.Context) error

ValidateSession counts the number of times this method is called.

type Index

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

func (idx *Index) CanSupport(...sql.Range) bool

func (*Index) ColumnExpressionTypes

func (idx *Index) ColumnExpressionTypes() []sql.ColumnExpressionType

ColumnExpressionTypes implements the interface sql.Index.

func (*Index) ColumnExpressions

func (idx *Index) ColumnExpressions() []sql.Expression

func (*Index) Comment

func (idx *Index) Comment() string

func (*Index) Database

func (idx *Index) Database() string

func (*Index) Driver

func (idx *Index) Driver() string

func (*Index) Expressions

func (idx *Index) Expressions() []string

func (*Index) ExtendedColumnExpressionTypes

func (idx *Index) ExtendedColumnExpressionTypes() []sql.ColumnExpressionType

func (*Index) ExtendedExpressions

func (idx *Index) ExtendedExpressions() []string

func (*Index) FullTextKeyColumns

func (idx *Index) FullTextKeyColumns(ctx *sql.Context) (fulltext.KeyColumns, error)

func (*Index) FullTextTableNames

func (idx *Index) FullTextTableNames(ctx *sql.Context) (fulltext.IndexTableNames, error)

func (*Index) HandledFilters

func (idx *Index) HandledFilters(filters []sql.Expression) []sql.Expression

func (*Index) ID

func (idx *Index) ID() string

func (*Index) IndexType

func (idx *Index) IndexType() string

func (*Index) IsFullText

func (idx *Index) IsFullText() bool

func (*Index) IsGenerated

func (idx *Index) IsGenerated() bool

func (*Index) IsSpatial

func (idx *Index) IsSpatial() bool

func (*Index) IsUnique

func (idx *Index) IsUnique() bool

func (*Index) MemTable

func (idx *Index) MemTable() *Table

func (*Index) Order

func (idx *Index) Order() sql.IndexOrder

func (*Index) PrefixLengths

func (idx *Index) PrefixLengths() []uint16

func (*Index) Reversible

func (idx *Index) Reversible() bool

func (*Index) Table

func (idx *Index) Table() string

type IndexValue

type IndexValue struct {
	Key string
	Pos int
}

func DecodeIndexValue

func DecodeIndexValue(data []byte) (*IndexValue, error)

type IndexedTable

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

func (t *IndexedTable) LookupPartitions(ctx *sql.Context, lookup sql.IndexLookup) (sql.PartitionIter, error)

func (*IndexedTable) PartitionRows

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

PartitionRows implements the sql.PartitionRows interface.

type IntSequenceTable

type IntSequenceTable struct {
	Len int
	// contains filtered or unexported fields
}

IntSequenceTable a simple table function that returns a sequence of integers.

func (IntSequenceTable) CheckPrivileges

func (IntSequenceTable) Children

func (s IntSequenceTable) Children() []sql.Node

func (IntSequenceTable) CollationCoercibility

func (IntSequenceTable) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte)

CollationCoercibility implements the interface sql.CollationCoercible.

func (IntSequenceTable) Database

func (s IntSequenceTable) Database() sql.Database

func (IntSequenceTable) DebugString

func (s IntSequenceTable) DebugString() string

func (IntSequenceTable) Description

func (s IntSequenceTable) Description() string

func (IntSequenceTable) Expressions

func (s IntSequenceTable) Expressions() []sql.Expression

func (IntSequenceTable) Name

func (s IntSequenceTable) Name() string

func (IntSequenceTable) NewInstance

func (s IntSequenceTable) NewInstance(_ *sql.Context, _ sql.Database, args []sql.Expression) (sql.Node, error)

func (IntSequenceTable) Resolved

func (s IntSequenceTable) Resolved() bool

func (IntSequenceTable) RowIter

func (s IntSequenceTable) RowIter(_ *sql.Context, _ sql.Row) (sql.RowIter, error)

func (IntSequenceTable) Schema

func (s IntSequenceTable) Schema() sql.Schema

func (IntSequenceTable) String

func (s IntSequenceTable) String() string

func (IntSequenceTable) WithChildren

func (s IntSequenceTable) WithChildren(_ ...sql.Node) (sql.Node, error)

func (IntSequenceTable) WithDatabase

func (s IntSequenceTable) WithDatabase(_ sql.Database) (sql.Node, error)

func (IntSequenceTable) WithExpressions

func (s IntSequenceTable) WithExpressions(e ...sql.Expression) (sql.Node, error)

type MemoryDatabase

type MemoryDatabase interface {
	sql.Database
	AddTable(name string, t sql.Table)
}

type Partition

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

func NewPartition

func NewPartition(key []byte) *Partition

func (*Partition) Key

func (p *Partition) Key() []byte

type ProviderOption

type ProviderOption func(*DbProvider)

func HistoryProvider

func HistoryProvider(enableHistory bool) ProviderOption

HistoryProvider returns a ProviderOption to construct a memoryDBProvider that uses history databases

func NativeIndexProvider

func NativeIndexProvider(useNativeIndexes bool) ProviderOption

func ReadOnlyProvider

func ReadOnlyProvider(enableReadOnly bool) ProviderOption

ReadOnlyProvider returns a ProviderOption to construct a memoryDBProvider that is read-only

func WithDbsOption

func WithDbsOption(dbs []sql.Database) ProviderOption

WithDbsOption returns a ProviderOption to construct a DbProvider with the given databases

type ReadOnlyDatabase

type ReadOnlyDatabase struct {
	*HistoryDatabase
}

func NewReadOnlyDatabase

func NewReadOnlyDatabase(name string) ReadOnlyDatabase

func (ReadOnlyDatabase) IsReadOnly

func (d ReadOnlyDatabase) IsReadOnly() bool

type SequenceTableFnRowIter

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

func NewSequenceTableFnRowIter

func NewSequenceTableFnRowIter(n int) *SequenceTableFnRowIter

func (*SequenceTableFnRowIter) Close

func (i *SequenceTableFnRowIter) Close(_ *sql.Context) error

func (*SequenceTableFnRowIter) Next

func (i *SequenceTableFnRowIter) Next(_ *sql.Context) (sql.Row, error)

type Table

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

Table represents an in-memory database table.

func NewPartitionedTable

func NewPartitionedTable(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

func NewPartitionedTableWithCollation(name string, schema sql.PrimaryKeySchema, fkColl *ForeignKeyCollection, numPartitions int, collation sql.CollationID) *Table

NewPartitionedTableWithCollation creates a new Table with the given name, schema, number of partitions, and collation.

func NewTable

func NewTable(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

func NewTableWithCollation(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) AddColumn

func (t *Table) AddColumn(ctx *sql.Context, column *sql.Column, order *sql.ColumnOrder) error

func (*Table) AddForeignKey

func (t *Table) AddForeignKey(ctx *sql.Context, fk sql.ForeignKeyConstraint) error

AddForeignKey implements sql.ForeignKeyTable. Foreign partitionKeys are not enforced on update / delete.

func (*Table) AnalyzeTable

func (t *Table) AnalyzeTable(ctx *sql.Context) error

AnalyzeTable implements the sql.StatisticsTable interface.

func (*Table) AutoIncrementSetter

func (t *Table) AutoIncrementSetter(ctx *sql.Context) sql.AutoIncrementSetter

func (*Table) Collation

func (t *Table) Collation() sql.CollationID

Collation implements the sql.Table interface.

func (*Table) CreateCheck

func (t *Table) CreateCheck(_ *sql.Context, check *sql.CheckDefinition) error

CreateCheck implements sql.CheckAlterableTable

func (*Table) CreateFulltextIndex

func (t *Table) CreateFulltextIndex(ctx *sql.Context, indexDef sql.IndexDef, keyCols fulltext.KeyColumns, tableNames fulltext.IndexTableNames) error

CreateFulltextIndex implements fulltext.IndexAlterableTable

func (*Table) CreateIndex

func (t *Table) CreateIndex(ctx *sql.Context, idx sql.IndexDef) error

CreateIndex implements sql.IndexAlterableTable

func (*Table) CreateIndexForForeignKey

func (t *Table) CreateIndexForForeignKey(ctx *sql.Context, idx sql.IndexDef) error

CreateIndexForForeignKey implements sql.ForeignKeyTable.

func (*Table) CreatePrimaryKey

func (t *Table) CreatePrimaryKey(ctx *sql.Context, columns []sql.IndexColumn) error

CreatePrimaryKey implements the PrimaryKeyAlterableTable

func (*Table) DataLength

func (t *Table) DataLength(ctx *sql.Context) (uint64, error)

func (*Table) DebugString

func (t *Table) DebugString() string

func (*Table) Deleter

func (t *Table) Deleter(ctx *sql.Context) sql.RowDeleter

func (*Table) DropCheck

func (t *Table) DropCheck(ctx *sql.Context, chName string) error

DropCheck implements sql.CheckAlterableTable.

func (*Table) DropColumn

func (t *Table) DropColumn(ctx *sql.Context, columnName string) error

func (*Table) DropForeignKey

func (t *Table) DropForeignKey(ctx *sql.Context, fkName string) error

DropForeignKey implements sql.ForeignKeyTable.

func (*Table) DropIndex

func (t *Table) DropIndex(ctx *sql.Context, indexName string) error

DropIndex implements sql.IndexAlterableTable

func (*Table) DropPrimaryKey

func (t *Table) DropPrimaryKey(ctx *sql.Context) error

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

func (t *Table) GetChecks(_ *sql.Context) ([]sql.CheckDefinition, error)

GetChecks implements sql.CheckTable

func (*Table) GetDeclaredForeignKeys

func (t *Table) GetDeclaredForeignKeys(ctx *sql.Context) ([]sql.ForeignKeyConstraint, error)

GetDeclaredForeignKeys implements the interface sql.ForeignKeyTable.

func (*Table) GetForeignKeyEditor

func (t *Table) GetForeignKeyEditor(ctx *sql.Context) sql.ForeignKeyEditor

GetForeignKeyEditor implements sql.ForeignKeyTable.

func (*Table) GetIndexes

func (t *Table) GetIndexes(ctx *sql.Context) ([]sql.Index, error)

GetIndexes implements sql.IndexedTable

func (*Table) GetNextAutoIncrementValue

func (t *Table) GetNextAutoIncrementValue(ctx *sql.Context, insertVal interface{}) (uint64, error)

GetNextAutoIncrementValue gets the next auto increment value for the memory table the increment.

func (*Table) GetPartition

func (t *Table) GetPartition(key string) []sql.Row

func (*Table) GetReferencedForeignKeys

func (t *Table) GetReferencedForeignKeys(ctx *sql.Context) ([]sql.ForeignKeyConstraint, error)

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

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

IndexKeyValues implements the sql.IndexableTable interface.

func (*Table) IndexedAccess

func (t *Table) IndexedAccess(i sql.IndexLookup) sql.IndexedTable

func (*Table) Insert

func (t *Table) Insert(ctx *sql.Context, row sql.Row) error

Convenience method to avoid having to create an inserter in test setup

func (*Table) Inserter

func (t *Table) Inserter(ctx *sql.Context) sql.RowInserter

func (*Table) ModifyColumn

func (t *Table) ModifyColumn(ctx *sql.Context, columnName string, column *sql.Column, order *sql.ColumnOrder) error

func (*Table) ModifyDefaultCollation

func (t *Table) ModifyDefaultCollation(ctx *sql.Context, collation sql.CollationID) error

ModifyDefaultCollation implements sql.CollationAlterableTable

func (*Table) ModifyStoredCollation

func (t *Table) ModifyStoredCollation(ctx *sql.Context, collation sql.CollationID) error

ModifyStoredCollation implements sql.CollationAlterableTable

func (Table) Name

func (t Table) Name() string

Name implements the sql.Table interface.

func (*Table) PartitionCount

func (t *Table) PartitionCount(ctx *sql.Context) (int64, error)

PartitionCount implements the sql.PartitionCounter interface.

func (*Table) PartitionRows

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

PartitionRows implements the sql.PartitionRows interface.

func (*Table) Partitions

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

Partitions implements the sql.Table interface.

func (*Table) PeekNextAutoIncrementValue

func (t *Table) PeekNextAutoIncrementValue(*sql.Context) (uint64, error)

PeekNextAutoIncrementValue peeks at the next AUTO_INCREMENT value

func (*Table) PrimaryKeySchema

func (t *Table) PrimaryKeySchema() sql.PrimaryKeySchema

PrimaryKeySchema implements sql.PrimaryKeyAlterableTable

func (*Table) Projections

func (t *Table) Projections() []string

Projections implements sql.ProjectedTable

func (*Table) RenameIndex

func (t *Table) RenameIndex(ctx *sql.Context, fromIndexName string, toIndexName string) error

RenameIndex implements sql.IndexAlterableTable

func (*Table) Replacer

func (t *Table) Replacer(ctx *sql.Context) sql.RowReplacer

func (*Table) RowCount

func (t *Table) RowCount(ctx *sql.Context) (uint64, error)

func (*Table) Schema

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

Schema implements the sql.Table interface.

func (*Table) SetForeignKeyResolved

func (t *Table) SetForeignKeyResolved(ctx *sql.Context, fkName string) error

SetForeignKeyResolved implements sql.ForeignKeyTable.

func (*Table) String

func (t *Table) String() string

String implements the sql.Table interface.

func (*Table) Truncate

func (t *Table) Truncate(ctx *sql.Context) (int, error)

func (*Table) UpdateForeignKey

func (t *Table) UpdateForeignKey(ctx *sql.Context, fkName string, fk sql.ForeignKeyConstraint) error

UpdateForeignKey implements sql.ForeignKeyTable.

func (*Table) Updater

func (t *Table) Updater(ctx *sql.Context) sql.RowUpdater

func (*Table) WithDriverIndexLookup

func (t *Table) WithDriverIndexLookup(lookup sql.DriverIndexLookup) sql.Table

WithDriverIndexLookup implements the sql.IndexAddressableTable interface.

func (*Table) WithProjections

func (t *Table) WithProjections(cols []string) sql.Table

WithProjections implements sql.ProjectedTable

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 (*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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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