Documentation
¶
Index ¶
- type Database
- type PostgresDB
- func (db *PostgresDB) ApplyMigration(ctx context.Context, tx *sql.Tx, migrationName string, cwd string) error
- func (db *PostgresDB) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
- func (db *PostgresDB) Close() error
- func (db *PostgresDB) DeleteMigration(ctx context.Context, tx *sql.Tx, batchNum int) error
- func (db *PostgresDB) GetAppliedMigrations() (*sql.Rows, error)
- func (db *PostgresDB) GetAppliedMigrationsByBatch(batch int) (*sql.Rows, error)
- func (db *PostgresDB) GetLastBatchNumber() (int, error)
- func (db *PostgresDB) GetMigrationsToRevert(batch int) ([]string, error)
- func (db *PostgresDB) GetNextBatchNumber() (int, error)
- func (db *PostgresDB) GetUnappliedMigrations(cwd string) ([]string, error)
- func (db *PostgresDB) RecordMigration(ctx context.Context, tx *sql.Tx, migrationName string, batchNum int) error
- func (db *PostgresDB) RevertMigration(ctx context.Context, tx *sql.Tx, migrationName string, cwd string) error
- type SQLiteDB
- func (db *SQLiteDB) ApplyMigration(ctx context.Context, tx *sql.Tx, migrationName string, cwd string) error
- func (db *SQLiteDB) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
- func (db *SQLiteDB) Close() error
- func (db *SQLiteDB) DeleteMigration(ctx context.Context, tx *sql.Tx, batchNum int) error
- func (db *SQLiteDB) GetAppliedMigrations() (*sql.Rows, error)
- func (db *SQLiteDB) GetAppliedMigrationsByBatch(batch int) (*sql.Rows, error)
- func (db *SQLiteDB) GetLastBatchNumber() (int, error)
- func (db *SQLiteDB) GetMigrationsToRevert(batch int) ([]string, error)
- func (db *SQLiteDB) GetNextBatchNumber() (int, error)
- func (db *SQLiteDB) GetUnappliedMigrations(cwd string) ([]string, error)
- func (db *SQLiteDB) RecordMigration(ctx context.Context, tx *sql.Tx, migrationName string, batchNum int) error
- func (db *SQLiteDB) RevertMigration(ctx context.Context, tx *sql.Tx, migrationName string, cwd string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database interface {
ApplyMigration(ctx context.Context, tx *sql.Tx, migrationName string, cwd string) error
RecordMigration(ctx context.Context, tx *sql.Tx, migrationName string, batchNum int) error
RevertMigration(ctx context.Context, tx *sql.Tx, migrationName string, cwd string) error
DeleteMigration(ctx context.Context, tx *sql.Tx, batchNum int) error
BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
GetNextBatchNumber() (int, error)
GetLastBatchNumber() (int, error)
GetAppliedMigrations() (*sql.Rows, error)
GetUnappliedMigrations(cwd string) ([]string, error)
GetMigrationsToRevert(batch int) ([]string, error)
ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
Close() error
}
func NewDatabase ¶
type PostgresDB ¶
func (*PostgresDB) ApplyMigration ¶
func (*PostgresDB) Close ¶
func (db *PostgresDB) Close() error
func (*PostgresDB) DeleteMigration ¶
func (*PostgresDB) GetAppliedMigrations ¶
func (db *PostgresDB) GetAppliedMigrations() (*sql.Rows, error)
func (*PostgresDB) GetAppliedMigrationsByBatch ¶
func (db *PostgresDB) GetAppliedMigrationsByBatch(batch int) (*sql.Rows, error)
func (*PostgresDB) GetLastBatchNumber ¶
func (db *PostgresDB) GetLastBatchNumber() (int, error)
func (*PostgresDB) GetMigrationsToRevert ¶
func (db *PostgresDB) GetMigrationsToRevert(batch int) ([]string, error)
func (*PostgresDB) GetNextBatchNumber ¶
func (db *PostgresDB) GetNextBatchNumber() (int, error)
func (*PostgresDB) GetUnappliedMigrations ¶
func (db *PostgresDB) GetUnappliedMigrations(cwd string) ([]string, error)
func (*PostgresDB) RecordMigration ¶
func (*PostgresDB) RevertMigration ¶
type SQLiteDB ¶
func (*SQLiteDB) ApplyMigration ¶
func (*SQLiteDB) DeleteMigration ¶
func (*SQLiteDB) GetAppliedMigrations ¶
func (*SQLiteDB) GetAppliedMigrationsByBatch ¶
func (*SQLiteDB) GetLastBatchNumber ¶
func (*SQLiteDB) GetMigrationsToRevert ¶
func (*SQLiteDB) GetNextBatchNumber ¶
func (*SQLiteDB) GetUnappliedMigrations ¶
func (*SQLiteDB) RecordMigration ¶
Click to show internal directories.
Click to hide internal directories.