Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dialect ¶
type Dialect string
Dialect is the type of database dialect.
const ( Postgres Dialect = "postgres" Mysql Dialect = "mysql" Sqlite3 Dialect = "sqlite3" Sqlserver Dialect = "sqlserver" Redshift Dialect = "redshift" Tidb Dialect = "tidb" Clickhouse Dialect = "clickhouse" Vertica Dialect = "vertica" Ydb Dialect = "ydb" Turso Dialect = "turso" Starrocks Dialect = "starrocks" )
type GetMigrationResult ¶
type ListMigrationsResult ¶
type Store ¶
type Store interface { // CreateVersionTable creates the version table within a transaction. // This table is used to store goose migrations. CreateVersionTable(ctx context.Context, tx *sql.Tx, tableName string) error // InsertVersion inserts a version id into the version table within a transaction. InsertVersion(ctx context.Context, tx *sql.Tx, tableName string, version int64) error // InsertVersionNoTx inserts a version id into the version table without a transaction. InsertVersionNoTx(ctx context.Context, db *sql.DB, tableName string, version int64) error // DeleteVersion deletes a version id from the version table within a transaction. DeleteVersion(ctx context.Context, tx *sql.Tx, tableName string, version int64) error // DeleteVersionNoTx deletes a version id from the version table without a transaction. DeleteVersionNoTx(ctx context.Context, db *sql.DB, tableName string, version int64) error // GetMigrationRow retrieves a single migration by version id. // // Returns the raw sql error if the query fails. It is the callers responsibility // to assert for the correct error, such as sql.ErrNoRows. GetMigration(ctx context.Context, db *sql.DB, tableName string, version int64) (*GetMigrationResult, error) // ListMigrations retrieves all migrations sorted in descending order by id. // // If there are no migrations, an empty slice is returned with no error. ListMigrations(ctx context.Context, db *sql.DB, tableName string) ([]*ListMigrationsResult, error) }
Store is the interface that wraps the basic methods for a database dialect.
A dialect is a set of SQL statements that are specific to a database.
By defining a store interface, we can support multiple databases with a single codebase.
The underlying implementation does not modify the error. It is the callers responsibility to assert for the correct error, such as sql.ErrNoRows.
Click to show internal directories.
Click to hide internal directories.