postgres

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 21, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PostgresDriver

type PostgresDriver struct {
	// contains filtered or unexported fields
}

PostgresDriver implements the driver.DatabaseDriver interface for PostgreSQL.

func New

func New() *PostgresDriver

New creates a new instance of PostgresDriver.

func (*PostgresDriver) Apply

func (p *PostgresDriver) Apply(ctx context.Context, payload driver.MigrationPayload) error

Apply executes the UP migration in a single transaction to prevent dirty states.

func (*PostgresDriver) Close

func (p *PostgresDriver) Close(ctx context.Context) error

Close gracefully closes the database connection.

func (*PostgresDriver) DropAll

func (p *PostgresDriver) DropAll(ctx context.Context) error

DropAll completely wipes the database schema. USE WITH EXTREME CAUTION.

func (*PostgresDriver) DryRun

func (p *PostgresDriver) DryRun(ctx context.Context, payload driver.MigrationPayload) error

DryRun executes the migration inside a transaction but forces a rollback at the end. This validates the SQL syntax and constraints without altering the database state.

func (*PostgresDriver) ExecuteSeed

func (p *PostgresDriver) ExecuteSeed(ctx context.Context, rawSQL string) error

ExecuteSeed runs raw SQL within a transaction without tracking its state. Ideal for idempotent data seeding operations.

func (*PostgresDriver) GetAppliedMigrations

func (p *PostgresDriver) GetAppliedMigrations(ctx context.Context) ([]driver.MigrationRecord, error)

GetAppliedMigrations fetches the history of successful migrations from the database. This is used by the Engine to determine which files in the directory are pending.

func (*PostgresDriver) Initialize

func (p *PostgresDriver) Initialize(ctx context.Context, connectionURL string) error

Initialize connects to the database and ensures the migration metadata table exists.

func (*PostgresDriver) Revert

func (p *PostgresDriver) Revert(ctx context.Context, payload driver.MigrationPayload) error

Revert executes the DOWN migration in a single transaction. It removes the schema changes and deletes the metadata record simultaneously.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL