mysqlshim

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

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

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

AllViews implements the interface sql.ViewDatabase.

func (Database) CreateTable

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

CreateTable implements the interface sql.TableCreator.

func (Database) CreateTrigger

func (d Database) CreateTrigger(ctx *sql.Context, definition sql.TriggerDefinition) error

CreateTrigger implements the interface sql.TriggerDatabase.

func (Database) CreateView

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

CreateView implements the interface sql.ViewDatabase.

func (Database) DropStoredProcedure

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

DropStoredProcedure implements the interface sql.StoredProcedureDatabase.

func (Database) DropTable

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

DropTable implements the interface sql.TableDropper.

func (Database) DropTrigger

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

DropTrigger implements the interface sql.TriggerDatabase.

func (Database) DropView

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

DropView implements the interface sql.ViewDatabase.

func (Database) GetStoredProcedures

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

GetStoredProcedures implements the interface sql.StoredProcedureDatabase.

func (Database) GetTableInsensitive

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

GetTableInsensitive implements the interface sql.Database.

func (Database) GetTableNames

func (d Database) GetTableNames(ctx *sql.Context) ([]string, error)

GetTableNames implements the interface sql.Database.

func (Database) GetTriggers

func (d Database) GetTriggers(ctx *sql.Context) ([]sql.TriggerDefinition, error)

GetTriggers implements the interface sql.TriggerDatabase.

func (Database) GetView

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

GetView implements the interface sql.ViewDatabase.

func (Database) Name

func (d Database) Name() string

Name implements the interface sql.Database.

func (Database) RenameTable

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

RenameTable implements the interface sql.TableRenamer.

func (Database) SaveStoredProcedure

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

SaveStoredProcedure implements the interface sql.StoredProcedureDatabase.

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

func NewMySQLShim(user string, password string, host string, port int) (*MySQLShim, error)

NewMySQLShim returns a new MySQLShim.

func (*MySQLShim) AllDatabases

func (m *MySQLShim) AllDatabases() []sql.Database

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

func (m *MySQLShim) CreateDatabase(ctx *sql.Context, name string) error

CreateDatabase implements the interface sql.MutableDatabaseProvider.

func (*MySQLShim) Database

func (m *MySQLShim) Database(name string) (sql.Database, error)

Database implements the interface sql.MutableDatabaseProvider.

func (*MySQLShim) DropDatabase

func (m *MySQLShim) DropDatabase(ctx *sql.Context, name string) error

DropDatabase implements the interface sql.MutableDatabaseProvider.

func (*MySQLShim) Exec

func (m *MySQLShim) Exec(db string, query string) error

Exec executes the query on the connection.

func (*MySQLShim) HasDatabase

func (m *MySQLShim) HasDatabase(name string) bool

HasDatabase implements the interface sql.MutableDatabaseProvider.

func (*MySQLShim) Query

func (m *MySQLShim) Query(db string, query string) (sql.RowIter, error)

Query queries the connection and return a row iterator.

func (*MySQLShim) QueryRows

func (m *MySQLShim) QueryRows(db string, query string) ([]sql.Row, error)

QueryRows queries the connection and returns the rows returned.

type Table

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

Table represents a table for a local MySQL server.

func (Table) AddColumn

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

AddColumn implements the interface sql.AlterableTable.

func (Table) Close

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

Close implements the interface sql.AutoIncrementSetter.

func (Table) CreateCheck

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

CreateCheck implements the interface sql.CheckAlterableTable.

func (Table) CreateForeignKey

func (t Table) CreateForeignKey(ctx *sql.Context, fkName string, columns []string, referencedTable string, referencedColumns []string, onUpdate, onDelete sql.ForeignKeyReferenceOption) error

CreateForeignKey implements the interface sql.ForeignKeyAlterableTable.

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 the interface sql.IndexAlterableTable.

func (Table) CreatePrimaryKey

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

CreatePrimaryKey implements the interface sql.PrimaryKeyAlterableTable.

func (Table) DataLength

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

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

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

DropCheck implements the interface sql.CheckAlterableTable.

func (Table) DropColumn

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

DropColumn implements the interface sql.AlterableTable.

func (Table) DropForeignKey

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

DropForeignKey implements the interface sql.ForeignKeyAlterableTable.

func (Table) DropIndex

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

DropIndex implements the interface sql.IndexAlterableTable.

func (Table) DropPrimaryKey

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

DropPrimaryKey implements the interface sql.PrimaryKeyAlterableTable.

func (Table) GetChecks

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

GetChecks implements the interface sql.CheckTable.

func (Table) GetForeignKeys

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

GetForeignKeys implements the interface sql.ForeignKeyTable.

func (Table) GetIndexes

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

GetIndexes implements the interface sql.IndexedTable.

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

func (t Table) Name() string

Name implements the interface sql.Table.

func (Table) NumRows

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

NumRows implements the interface sql.StatisticsTable.

func (Table) PartitionRows

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

PartitionRows implements the interface sql.Table.

func (Table) Partitions

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

Partitions implements the interface sql.Table.

func (Table) Pks

func (t Table) Pks() []sql.IndexColumn

Pks implements sql.PrimaryKeyAlterableTable

func (Table) PrimaryKeySchema

func (t Table) PrimaryKeySchema() sql.PrimaryKeySchema

PrimaryKeySchema implements sql.PrimaryKeyAlterableTable

func (Table) RenameIndex

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

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

func (t Table) Schema() sql.Schema

Schema implements the interface sql.Table.

func (Table) String

func (t Table) String() string

String implements the interface sql.Table.

func (Table) Truncate

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

Truncate implements the interface sql.TruncateableTable.

func (Table) Updater

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

Updater implements the interface sql.UpdatableTable.

func (Table) WithIndexLookup

func (t Table) WithIndexLookup(lookup sql.IndexLookup) sql.Table

WithIndexLookup implements the interface sql.IndexAddressableTable.

Jump to

Keyboard shortcuts

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