Documentation ¶
Index ¶
- type Migration
- type Store
- func (s *Store) CreateVersionTable(ctx context.Context, _ database.DBTxConn) error
- func (s *Store) Delete(ctx context.Context, _ database.DBTxConn, version int64) error
- func (s *Store) GetLatestVersion(ctx context.Context, _ database.DBTxConn) (int64, error)
- func (s *Store) GetMigration(ctx context.Context, _ database.DBTxConn, version int64) (*database.GetMigrationResult, error)
- func (s *Store) Insert(ctx context.Context, _ database.DBTxConn, req database.InsertRequest) error
- func (s *Store) ListMigrations(ctx context.Context, _ database.DBTxConn) ([]*database.ListMigrationsResult, error)
- func (s *Store) Tablename() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) CreateVersionTable ¶
CreateVersionTable creates the version table, which is used to track migrations.
func (*Store) GetLatestVersion ¶
GetLatestVersion retrieves the last applied migration version. If no migrations exist, this method must return [ErrVersionNotFound].
func (*Store) GetMigration ¶
func (s *Store) GetMigration( ctx context.Context, _ database.DBTxConn, version int64, ) (*database.GetMigrationResult, error)
GetMigration retrieves a single migration by version id. If the query succeeds, but the version is not found, this method must return [ErrVersionNotFound].
func (*Store) ListMigrations ¶
func (s *Store) ListMigrations(ctx context.Context, _ database.DBTxConn) ([]*database.ListMigrationsResult, error)
ListMigrations retrieves all migrations sorted in descending order by id or timestamp. If there are no migrations, return empty slice with no error. Typically this method will return at least one migration, because the initial version (0) is always inserted into the version table when it is created.