Documentation
¶
Index ¶
- type MigrationInfo
- type MigrationOpts
- type MigrationOptsCH
- type MigrationOptsPG
- type Migrator
- func (m *Migrator) Close(ctx context.Context) (error, error)
- func (m *Migrator) Down(ctx context.Context, n int) (int, int, error)
- func (m *Migrator) Force(ctx context.Context, version int) error
- func (m *Migrator) LatestVersion() (int, error)
- func (m *Migrator) ListMigrations(ctx context.Context) ([]MigrationInfo, error)
- func (m *Migrator) PendingCount(ctx context.Context) (int, error)
- func (m *Migrator) Up(ctx context.Context, n int) (int, int, error)
- func (m *Migrator) Version(ctx context.Context) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MigrationInfo ¶ added in v0.17.0
MigrationInfo describes a single SQL migration and its applied state.
type MigrationOpts ¶
type MigrationOpts struct {
PG MigrationOptsPG
CH MigrationOptsCH
}
type MigrationOptsCH ¶
type MigrationOptsPG ¶
type MigrationOptsPG struct {
URL string
}
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
func New ¶
func New(opts MigrationOpts) (*Migrator, error)
func (*Migrator) Down ¶
Down migrates the database down by n migrations. It returns the updated version, the number of migrations rolled back, and an error.
func (*Migrator) LatestVersion ¶ added in v0.17.0
LatestVersion returns the highest migration version available in the embedded migration files. Returns 0 if there are no migrations.
func (*Migrator) ListMigrations ¶ added in v0.17.0
func (m *Migrator) ListMigrations(ctx context.Context) ([]MigrationInfo, error)
ListMigrations returns all available SQL migrations in version order, with Applied set based on the migrator's current schema version.
func (*Migrator) PendingCount ¶ added in v0.17.0
PendingCount returns the number of migrations that would be applied by running Up(-1) from the current state.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package coordinator provides a unified interface over the SQL and Redis migration subsystems so callers (CLI, startup checks) can work with "migrations" as a single concept instead of two separate systems.
|
Package coordinator provides a unified interface over the SQL and Redis migration subsystems so callers (CLI, startup checks) can work with "migrations" as a single concept instead of two separate systems. |
|
Package migrations provides a central registry for all Redis migrations.
|
Package migrations provides a central registry for all Redis migrations. |
Click to show internal directories.
Click to hide internal directories.