package dialect
import "github.com/pressly/goose/v3/internal/dialect"
Index ¶
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" )
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.
func NewStore ¶
NewStore returns a new Store for the given dialect.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
internal/dialect/dialectquery |
- Version
- v3.16.0
- Published
- Nov 12, 2023
- Platform
- linux/amd64
- Imports
- 5 packages
- Last checked
- 3 hours ago –
Tools for package owners.