Documentation ¶
Index ¶
- type Database
- func (d Database) AllViews(ctx *sql.Context) ([]sql.ViewDefinition, error)
- func (d Database) CreateTable(ctx *sql.Context, name string, schema sql.PrimaryKeySchema, ...) error
- func (d Database) CreateTrigger(ctx *sql.Context, definition sql.TriggerDefinition) error
- func (d Database) CreateView(ctx *sql.Context, name string, selectStatement, createViewStmt string) error
- func (d Database) DropEvent(ctx *sql.Context, name string) error
- func (d Database) DropStoredProcedure(ctx *sql.Context, name string) error
- func (d Database) DropTable(ctx *sql.Context, name string) error
- func (d Database) DropTrigger(ctx *sql.Context, name string) error
- func (d Database) DropView(ctx *sql.Context, name string) error
- func (d Database) GetEvent(ctx *sql.Context, name string) (sql.EventDefinition, bool, error)
- func (d Database) GetEvents(_ *sql.Context) ([]sql.EventDefinition, interface{}, error)
- func (d Database) GetStoredProcedure(ctx *sql.Context, name string) (sql.StoredProcedureDetails, bool, error)
- func (d Database) GetStoredProcedures(ctx *sql.Context) ([]sql.StoredProcedureDetails, error)
- func (d Database) GetTableInsensitive(ctx *sql.Context, tblName string) (sql.Table, bool, error)
- func (d Database) GetTableNames(ctx *sql.Context) ([]string, error)
- func (d Database) GetTriggers(ctx *sql.Context) ([]sql.TriggerDefinition, error)
- func (d Database) GetViewDefinition(ctx *sql.Context, viewName string) (sql.ViewDefinition, bool, error)
- func (d Database) Name() string
- func (d Database) NeedsToReloadEvents(_ *sql.Context, _ interface{}) (bool, error)
- func (d Database) RenameTable(ctx *sql.Context, oldName, newName string) error
- func (d Database) SaveEvent(ctx *sql.Context, event sql.EventDefinition) (bool, error)
- func (d Database) SaveStoredProcedure(ctx *sql.Context, spd sql.StoredProcedureDetails) error
- func (d Database) UpdateEvent(_ *sql.Context, originalName string, event sql.EventDefinition) (bool, error)
- func (d Database) UpdateLastExecuted(ctx *sql.Context, eventName string, lastExecuted time.Time) error
- type MySQLDatabase
- type MySQLHarness
- func (m *MySQLHarness) Cleanup() error
- func (m *MySQLHarness) Close()
- func (m *MySQLHarness) NewContext() *sql.Context
- func (m *MySQLHarness) NewContextWithClient(client sql.Client) *sql.Context
- func (m *MySQLHarness) NewDatabase(name string) sql.Database
- func (m *MySQLHarness) NewDatabaseProvider() sql.MutableDatabaseProvider
- func (m *MySQLHarness) NewDatabases(names ...string) []sql.Database
- func (m *MySQLHarness) NewEngine(t *testing.T) (enginetest.QueryEngine, error)
- func (m *MySQLHarness) NewTable(db sql.Database, name string, schema sql.PrimaryKeySchema) (sql.Table, error)
- func (m *MySQLHarness) Parallelism() int
- func (m *MySQLHarness) Provider() sql.MutableDatabaseProvider
- func (m *MySQLHarness) QueriesToSkip(queries ...string)
- func (m *MySQLHarness) Setup(setupData ...[]setup.SetupScript)
- func (m *MySQLHarness) SkipQueryTest(query string) bool
- func (m *MySQLHarness) SupportsForeignKeys() bool
- func (m *MySQLHarness) SupportsKeylessTables() bool
- func (m *MySQLHarness) SupportsNativeIndexCreation() bool
- type MySQLShim
- func (m *MySQLShim) AllDatabases(*sql.Context) []sql.Database
- func (m *MySQLShim) Close()
- func (m *MySQLShim) CreateDatabase(ctx *sql.Context, name string) error
- func (m *MySQLShim) Database(ctx *sql.Context, name string) (sql.Database, error)
- func (m *MySQLShim) DropDatabase(ctx *sql.Context, name string) error
- func (m *MySQLShim) Exec(db string, query string) error
- func (m *MySQLShim) HasDatabase(ctx *sql.Context, name string) bool
- func (m *MySQLShim) Query(db string, query string) (sql.RowIter, error)
- func (m *MySQLShim) QueryRows(db string, query string) ([]sql.Row, error)
- type MySQLTable
- type 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) Close(ctx *sql.Context) error
- func (t Table) Collation() sql.CollationID
- func (t Table) CreateCheck(ctx *sql.Context, check *sql.CheckDefinition) 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) 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, indexName string) error
- func (t Table) DropPrimaryKey(ctx *sql.Context) error
- 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) GetReferencedForeignKeys(ctx *sql.Context) ([]sql.ForeignKeyConstraint, error)
- func (t Table) IndexedAccess(sql.IndexLookup) sql.IndexedTable
- func (t Table) IndexedPartitions(ctx *sql.Context, _ sql.IndexLookup) (sql.PartitionIter, 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) Name() string
- 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) Pks() []sql.IndexColumn
- func (t Table) PreciseMatch() bool
- func (t Table) PrimaryKeySchema() sql.PrimaryKeySchema
- func (t Table) RenameIndex(ctx *sql.Context, fromIndexName string, toIndexName string) error
- func (t Table) Replacer(ctx *sql.Context) sql.RowReplacer
- 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) String() string
- func (t Table) Truncate(ctx *sql.Context) (int, error)
- func (t Table) UpdateForeignKey(ctx *sql.Context, fkName string, fkDef sql.ForeignKeyConstraint) error
- func (t Table) Updater(ctx *sql.Context) sql.RowUpdater
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database represents a database for a local MySQL server.
func (Database) CreateTable ¶
func (d Database) CreateTable(ctx *sql.Context, name string, schema sql.PrimaryKeySchema, collation sql.CollationID, comment string) error
CreateTable implements the interface sql.TableCreator.
func (Database) CreateTrigger ¶
CreateTrigger implements the interface sql.TriggerDatabase.
func (Database) CreateView ¶
func (d Database) CreateView(ctx *sql.Context, name string, selectStatement, createViewStmt string) error
CreateView implements the interface sql.ViewDatabase.
func (Database) DropStoredProcedure ¶
DropStoredProcedure implements the interface sql.StoredProcedureDatabase.
func (Database) DropTrigger ¶
DropTrigger implements the interface sql.TriggerDatabase.
func (Database) GetStoredProcedure ¶
func (d Database) GetStoredProcedure(ctx *sql.Context, name string) (sql.StoredProcedureDetails, bool, error)
GetStoredProcedure implements the interface sql.StoredProcedureDatabase.
func (Database) GetStoredProcedures ¶
GetStoredProcedures implements the interface sql.StoredProcedureDatabase.
func (Database) GetTableInsensitive ¶
GetTableInsensitive implements the interface sql.Database.
func (Database) GetTableNames ¶
GetTableNames implements the interface sql.Database.
func (Database) GetTriggers ¶
GetTriggers implements the interface sql.TriggerDatabase.
func (Database) GetViewDefinition ¶
func (d Database) GetViewDefinition(ctx *sql.Context, viewName string) (sql.ViewDefinition, bool, error)
GetViewDefinition implements the interface sql.ViewDatabase.
func (Database) NeedsToReloadEvents ¶
NeedsToReloadEvents implements sql.EventDatabase
func (Database) RenameTable ¶
RenameTable implements the interface sql.TableRenamer.
func (Database) SaveStoredProcedure ¶
SaveStoredProcedure implements the interface sql.StoredProcedureDatabase.
func (Database) UpdateEvent ¶
func (d Database) UpdateEvent(_ *sql.Context, originalName string, event sql.EventDefinition) (bool, error)
UpdateEvent implements sql.EventDatabase
type MySQLDatabase ¶
type MySQLDatabase struct {
// contains filtered or unexported fields
}
MySQLDatabase represents a database for a local MySQL server.
type MySQLHarness ¶
type MySQLHarness struct {
// contains filtered or unexported fields
}
MySQLHarness is a harness for a local MySQL server. This will modify databases and tables as the tests see fit, which may delete pre-existing data. Ensure that the MySQL instance may freely be modified without worry.
func NewMySQLHarness ¶
NewMySQLHarness returns a new MySQLHarness.
func (*MySQLHarness) Cleanup ¶
func (m *MySQLHarness) Cleanup() error
func (*MySQLHarness) Close ¶
func (m *MySQLHarness) Close()
Close closes the connection. This will drop all databases created and accessed during the tests.
func (*MySQLHarness) NewContext ¶
func (m *MySQLHarness) NewContext() *sql.Context
NewContext implements the interface Harness.
func (*MySQLHarness) NewContextWithClient ¶
func (m *MySQLHarness) NewContextWithClient(client sql.Client) *sql.Context
func (*MySQLHarness) NewDatabase ¶
func (m *MySQLHarness) NewDatabase(name string) sql.Database
NewDatabase implements the interface Harness.
func (*MySQLHarness) NewDatabaseProvider ¶
func (m *MySQLHarness) NewDatabaseProvider() sql.MutableDatabaseProvider
NewDatabaseProvider implements the interface Harness.
func (*MySQLHarness) NewDatabases ¶
func (m *MySQLHarness) NewDatabases(names ...string) []sql.Database
NewDatabases implements the interface Harness.
func (*MySQLHarness) NewEngine ¶
func (m *MySQLHarness) NewEngine(t *testing.T) (enginetest.QueryEngine, error)
func (*MySQLHarness) NewTable ¶
func (m *MySQLHarness) NewTable(db sql.Database, name string, schema sql.PrimaryKeySchema) (sql.Table, error)
NewTable implements the interface Harness.
func (*MySQLHarness) Parallelism ¶
func (m *MySQLHarness) Parallelism() int
Parallelism implements the interface Harness.
func (*MySQLHarness) Provider ¶
func (m *MySQLHarness) Provider() sql.MutableDatabaseProvider
func (*MySQLHarness) QueriesToSkip ¶
func (m *MySQLHarness) QueriesToSkip(queries ...string)
QueriesToSkip adds queries that should be skipped.
func (*MySQLHarness) Setup ¶
func (m *MySQLHarness) Setup(setupData ...[]setup.SetupScript)
func (*MySQLHarness) SkipQueryTest ¶
func (m *MySQLHarness) SkipQueryTest(query string) bool
SkipQueryTest implements the interface SkippingHarness.
func (*MySQLHarness) SupportsForeignKeys ¶
func (m *MySQLHarness) SupportsForeignKeys() bool
SupportsForeignKeys implements the interface ForeignKeyHarness.
func (*MySQLHarness) SupportsKeylessTables ¶
func (m *MySQLHarness) SupportsKeylessTables() bool
SupportsKeylessTables implements the interface KeylessTableHarness.
func (*MySQLHarness) SupportsNativeIndexCreation ¶
func (m *MySQLHarness) SupportsNativeIndexCreation() bool
SupportsNativeIndexCreation implements the interface IndexHarness.
type MySQLShim ¶
type MySQLShim struct {
// contains filtered or unexported fields
}
MySQLShim is a shim for a local MySQL server. Ensure that a MySQL instance is running prior to using this shim. Note: this may be destructive to pre-existing data, as databases and tables will be created and destroyed.
func NewMySQLShim ¶
NewMySQLShim returns a new MySQLShim.
func (*MySQLShim) AllDatabases ¶
AllDatabases implements the interface sql.MutableDatabaseProvider.
func (*MySQLShim) Close ¶
func (m *MySQLShim) Close()
Close closes the shim. This will drop all databases created and accessed since this shim was created.
func (*MySQLShim) CreateDatabase ¶
CreateDatabase implements the interface sql.MutableDatabaseProvider.
func (*MySQLShim) DropDatabase ¶
DropDatabase implements the interface sql.MutableDatabaseProvider.
func (*MySQLShim) HasDatabase ¶
HasDatabase implements the interface sql.MutableDatabaseProvider.
type MySQLTable ¶
type MySQLTable struct {
// contains filtered or unexported fields
}
MySQLTable represents a table for a local MySQL server.
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table represents a table for a local MySQL server.
func (Table) AddForeignKey ¶
AddForeignKey implements the interface sql.ForeignKeyTable.
func (Table) Collation ¶
func (t Table) Collation() sql.CollationID
Collation implements the interface sql.Table.
func (Table) CreateCheck ¶
CreateCheck implements the interface sql.CheckAlterableTable.
func (Table) CreateIndex ¶
CreateIndex implements the interface sql.IndexAlterableTable.
func (Table) CreateIndexForForeignKey ¶
CreateIndexForForeignKey implements the interface sql.ForeignKeyTable.
func (Table) CreatePrimaryKey ¶
CreatePrimaryKey implements the interface sql.PrimaryKeyAlterableTable.
func (Table) DataLength ¶
DataLength implements the interface sql.StatisticsTable.
func (Table) Deleter ¶
func (t Table) Deleter(ctx *sql.Context) sql.RowDeleter
Deleter implements the interface sql.DeletableTable.
func (Table) DropColumn ¶
DropColumn implements the interface sql.AlterableTable.
func (Table) DropForeignKey ¶
DropForeignKey implements the interface sql.ForeignKeyTable.
func (Table) DropPrimaryKey ¶
DropPrimaryKey implements the interface sql.PrimaryKeyAlterableTable.
func (Table) GetDeclaredForeignKeys ¶
GetDeclaredForeignKeys implements the interface sql.ForeignKeyTable.
func (Table) GetForeignKeyEditor ¶
func (t Table) GetForeignKeyEditor(ctx *sql.Context) sql.ForeignKeyEditor
GetForeignKeyEditor implements the interface sql.ForeignKeyTable.
func (Table) GetIndexes ¶
GetIndexes implements the interface sql.IndexedTable.
func (Table) GetReferencedForeignKeys ¶
GetReferencedForeignKeys implements the interface sql.ForeignKeyTable.
func (Table) IndexedAccess ¶
func (t Table) IndexedAccess(sql.IndexLookup) sql.IndexedTable
func (Table) IndexedPartitions ¶
func (t Table) IndexedPartitions(ctx *sql.Context, _ sql.IndexLookup) (sql.PartitionIter, error)
func (Table) Inserter ¶
func (t Table) Inserter(ctx *sql.Context) sql.RowInserter
Inserter implements the interface sql.InsertableTable.
func (Table) ModifyColumn ¶
func (t Table) ModifyColumn(ctx *sql.Context, columnName string, column *sql.Column, order *sql.ColumnOrder) error
ModifyColumn implements the interface sql.AlterableTable.
func (Table) PartitionRows ¶
PartitionRows implements the interface sql.Table.
func (Table) Partitions ¶
Partitions implements the interface sql.Table.
func (Table) Pks ¶
func (t Table) Pks() []sql.IndexColumn
Pks implements sql.PrimaryKeyAlterableTable
func (Table) PreciseMatch ¶
func (Table) PrimaryKeySchema ¶
func (t Table) PrimaryKeySchema() sql.PrimaryKeySchema
PrimaryKeySchema implements sql.PrimaryKeyAlterableTable
func (Table) RenameIndex ¶
RenameIndex implements the interface sql.IndexAlterableTable.
func (Table) Replacer ¶
func (t Table) Replacer(ctx *sql.Context) sql.RowReplacer
Replacer implements the interface sql.ReplaceableTable.
func (Table) SetForeignKeyResolved ¶
SetForeignKeyResolved implements the interface sql.ForeignKeyTable.
func (Table) UpdateForeignKey ¶
func (t Table) UpdateForeignKey(ctx *sql.Context, fkName string, fkDef sql.ForeignKeyConstraint) error
UpdateForeignKey implements the interface sql.ForeignKeyTable.