Documentation
¶
Overview ¶
Package postgres provides a PostgreSQL driver for Queen migrations.
Index ¶
- type Driver
- func (d *Driver) Close() error
- func (d *Driver) Exec(ctx context.Context, fn func(*sql.Tx) error) error
- func (d *Driver) GetApplied(ctx context.Context) ([]queen.Applied, error)
- func (d *Driver) Init(ctx context.Context) error
- func (d *Driver) Lock(ctx context.Context, timeout time.Duration) error
- func (d *Driver) Record(ctx context.Context, m *queen.Migration) error
- func (d *Driver) Remove(ctx context.Context, version string) error
- func (d *Driver) Unlock(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver implements the queen.Driver interface for PostgreSQL.
func New ¶
New creates a new PostgreSQL driver. The database connection should already be open and configured. The default migrations table name is "queen_migrations".
func NewWithTableName ¶
NewWithTableName creates a new PostgreSQL driver with a custom table name.
func (*Driver) GetApplied ¶
GetApplied returns all applied migrations sorted by applied_at.
func (*Driver) Lock ¶
Lock acquires an advisory lock to prevent concurrent migrations. PostgreSQL advisory locks are automatically released when the connection closes or when explicitly unlocked.
Click to show internal directories.
Click to hide internal directories.