Documentation
¶
Index ¶
- type AppliedMigration
- type Migration
- type Migrator
- func (m *Migrator) GetLastMigrationID(ctx context.Context) (int, error)
- func (m *Migrator) MigrateTo(ctx context.Context, id int) error
- func (m *Migrator) MigrateToLatest(ctx context.Context) error
- func (m *Migrator) Rollback(ctx context.Context) error
- func (m *Migrator) RollbackUntil(ctx context.Context, id int) error
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppliedMigration ¶
type AppliedMigration struct {
ID int `db:"id"`
Description string `db:"description"`
AppliedAt time.Time `db:"applied_at"`
}
AppliedMigration is a struct that contains the status of a migration.
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
Migrator is a struct that contains all the methods to interact with the migrations table in the database.
func NewMigrator ¶
func NewMigrator( ctx context.Context, db *sqlx.DB, upMigrations, downMigrations embed.FS, opts *Options, ) (*Migrator, error)
NewMigrator creates a new migrator.
func (*Migrator) GetLastMigrationID ¶
GetLastMigrationID returns the last migration ID.
func (*Migrator) MigrateToLatest ¶
MigrateToLatest will apply all the migrations that have not been applied yet.
Click to show internal directories.
Click to hide internal directories.