postgres

package
v0.0.0-...-6d44edd Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package postgres implements the migration.Provider for PostgreSQL.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

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

Provider is the PostgreSQL migration.Provider: it owns the connection pool and knows how to lock, store history and run DDL transactionally.

func Open

func Open(ctx context.Context, dsn string) (*Provider, error)

Open connects to PostgreSQL and verifies the connection.

It builds the pool from a pq.Connector (via sql.OpenDB) rather than sql.Open("postgres", dsn): lib/pq's Driver does not implement driver.DriverContext, so sql.Open falls back to a path that ignores the context entirely during the TCP dial — a ctx deadline would never actually cut off connecting to an unreachable host. Connector.Connect does honor it.

func (*Provider) Close

func (p *Provider) Close() error

Close releases the underlying connection pool.

func (*Provider) DB

func (p *Provider) DB() migration.DB

DB returns the migration.DB the engine should use. The concrete value also implements migration.TxCapableDB, which NewEngine detects since this provider reports SupportsTransactionalDDL() == true.

func (*Provider) History

func (p *Provider) History() migration.HistoryStore

func (*Provider) Locker

func (p *Provider) Locker(migration.DB) migration.Locker

func (*Provider) Name

func (p *Provider) Name() string

func (*Provider) SupportsTransactionalDDL

func (p *Provider) SupportsTransactionalDDL() bool

Jump to

Keyboard shortcuts

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