postgres

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package postgres provides a PostgreSQL driver for Queen migrations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

type Driver struct {
	base.Driver
	// contains filtered or unexported fields
}

Driver implements the queen.Driver interface for PostgreSQL.

func New

func New(db *sql.DB) *Driver

New creates a new PostgreSQL driver.

func NewFromPool

func NewFromPool(pool *pgxpool.Pool) *Driver

NewFromPool creates a PostgreSQL driver from a native pgx pool.

The returned driver uses database/sql through pgx's stdlib adapter. Closing the driver closes only the adapter handle; it does not close the pgx pool.

func NewFromPoolWithTableName

func NewFromPoolWithTableName(pool *pgxpool.Pool, tableName string) *Driver

NewFromPoolWithTableName creates a PostgreSQL driver from a native pgx pool with a custom migration table name.

func NewWithTableName

func NewWithTableName(db *sql.DB, tableName string) *Driver

NewWithTableName creates a new PostgreSQL driver with a custom table name.

func (*Driver) Init

func (d *Driver) Init(ctx context.Context) error

Init creates the migrations tracking table if it doesn't exist.

func (*Driver) Lock

func (d *Driver) Lock(ctx context.Context, timeout time.Duration) error

Lock acquires an advisory lock to prevent concurrent migrations.

func (*Driver) RecordTx

func (d *Driver) RecordTx(ctx context.Context, tx *sql.Tx, m *queen.Migration, meta *queen.MigrationMetadata) error

RecordTx records an applied migration in the migration transaction.

func (*Driver) RemoveTx

func (d *Driver) RemoveTx(ctx context.Context, tx *sql.Tx, version string) error

RemoveTx removes a migration record in the rollback transaction.

func (*Driver) Unlock

func (d *Driver) Unlock(ctx context.Context) error

Unlock releases the advisory lock.

Jump to

Keyboard shortcuts

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