Documentation ¶
Index ¶
- type Driver
- func (Driver) CheckDuplicateVersion(ctx context.Context, tx *sql.Tx, namespace string, source db.MigrationSource, ...) (bool, error)
- func (Driver) CheckOutOfOrderVersion(ctx context.Context, tx *sql.Tx, namespace string, source db.MigrationSource, ...) (minVersionIfValid *string, err error)
- func (driver *Driver) Close(ctx context.Context) error
- func (driver *Driver) Dump(ctx context.Context, database string, out io.Writer, schemaOnly bool) error
- func (driver *Driver) Execute(ctx context.Context, statement string, useTransaction bool) error
- func (driver *Driver) ExecuteMigration(ctx context.Context, m *db.MigrationInfo, statement string) (int64, string, error)
- func (Driver) FindBaseline(ctx context.Context, tx *sql.Tx, namespace string) (hasBaseline bool, err error)
- func (driver *Driver) FindMigrationHistoryList(ctx context.Context, find *db.MigrationHistoryFind) ([]*db.MigrationHistory, error)
- func (Driver) FindNextSequence(ctx context.Context, tx *sql.Tx, namespace string, requireBaseline bool) (int, error)
- func (driver *Driver) GetDbConnection(ctx context.Context, database string) (*sql.DB, error)
- func (driver *Driver) GetVersion(ctx context.Context) (string, error)
- func (Driver) InsertPendingHistory(ctx context.Context, tx *sql.Tx, sequence int, prevSchema string, ...) (int64, error)
- func (driver *Driver) NeedsSetupMigration(ctx context.Context) (bool, error)
- func (driver *Driver) Open(ctx context.Context, dbType db.Type, config db.ConnectionConfig, ...) (db.Driver, error)
- func (driver *Driver) Ping(ctx context.Context) error
- func (driver *Driver) Query(ctx context.Context, statement string, limit int) ([]interface{}, error)
- func (driver *Driver) Restore(ctx context.Context, sc *bufio.Scanner) (err error)
- func (driver *Driver) SetupMigrationIfNeeded(ctx context.Context) error
- func (driver *Driver) SyncSchema(ctx context.Context) ([]*db.User, []*db.Schema, error)
- func (Driver) UpdateHistoryAsDone(ctx context.Context, tx *sql.Tx, migrationDurationNs int64, ...) error
- func (Driver) UpdateHistoryAsFailed(ctx context.Context, tx *sql.Tx, migrationDurationNs int64, insertedID int64) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver is the MySQL driver.
func (Driver) CheckDuplicateVersion ¶
func (Driver) CheckDuplicateVersion(ctx context.Context, tx *sql.Tx, namespace string, source db.MigrationSource, version string) (bool, error)
CheckDuplicateVersion will check whether the version is already applied.
func (Driver) CheckOutOfOrderVersion ¶
func (Driver) CheckOutOfOrderVersion(ctx context.Context, tx *sql.Tx, namespace string, source db.MigrationSource, version string) (minVersionIfValid *string, err error)
CheckOutOfOrderVersion will return versions that are higher than the given version.
func (*Driver) Dump ¶
func (driver *Driver) Dump(ctx context.Context, database string, out io.Writer, schemaOnly bool) error
Dump dumps the database.
func (*Driver) ExecuteMigration ¶
func (driver *Driver) ExecuteMigration(ctx context.Context, m *db.MigrationInfo, statement string) (int64, string, error)
ExecuteMigration will execute the migration.
func (Driver) FindBaseline ¶
func (Driver) FindBaseline(ctx context.Context, tx *sql.Tx, namespace string) (hasBaseline bool, err error)
FindBaseline retruns true if any baseline is found.
func (*Driver) FindMigrationHistoryList ¶
func (driver *Driver) FindMigrationHistoryList(ctx context.Context, find *db.MigrationHistoryFind) ([]*db.MigrationHistory, error)
FindMigrationHistoryList finds the migration history.
func (Driver) FindNextSequence ¶
func (Driver) FindNextSequence(ctx context.Context, tx *sql.Tx, namespace string, requireBaseline bool) (int, error)
FindNextSequence will return the highest sequence number plus one.
func (*Driver) GetDbConnection ¶
GetDbConnection gets a database connection.
func (*Driver) GetVersion ¶
GetVersion gets the version.
func (Driver) InsertPendingHistory ¶
func (Driver) InsertPendingHistory(ctx context.Context, tx *sql.Tx, sequence int, prevSchema string, m *db.MigrationInfo, statement string) (int64, error)
InsertPendingHistory will insert the migration record with pending status and return the inserted ID.
func (*Driver) NeedsSetupMigration ¶
NeedsSetupMigration returns whether it needs to setup migration.
func (*Driver) Open ¶
func (driver *Driver) Open(ctx context.Context, dbType db.Type, config db.ConnectionConfig, connCtx db.ConnectionContext) (db.Driver, error)
Open opens a MySQL driver.
func (*Driver) Query ¶
func (driver *Driver) Query(ctx context.Context, statement string, limit int) ([]interface{}, error)
Query queries a SQL statement.
func (*Driver) SetupMigrationIfNeeded ¶
SetupMigrationIfNeeded sets up migration if needed.
func (*Driver) SyncSchema ¶
SyncSchema synces the schema.