postgres

package
v0.4.23 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Differ

type Differ struct{}

Differ compares two SchemaState values and returns the changes needed to transition from current to desired.

func (*Differ) Diff

func (d *Differ) Diff(current, desired *migrate.SchemaState) ([]migrate.Change, error)

Diff returns the changes needed to transition from current to desired.

type Inspector

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

Inspector inspects a PostgreSQL database via system catalogs.

func NewInspector

func NewInspector(pool *pgxpool.Pool) *Inspector

NewInspector creates a new Inspector backed by the given connection pool.

func (*Inspector) InspectRealm

func (ins *Inspector) InspectRealm(ctx context.Context) (*migrate.SchemaState, error)

InspectRealm inspects all user-created schemas in the database.

func (*Inspector) InspectSchema

func (ins *Inspector) InspectSchema(ctx context.Context, name string) (*migrate.Schema, error)

InspectSchema inspects a single schema by name.

type Migrator

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

Migrator is the full PostgreSQL migration engine.

func NewMigrator

func NewMigrator(pool *pgxpool.Pool) *Migrator

NewMigrator creates a new PostgreSQL Migrator.

func (*Migrator) Diff

func (m *Migrator) Diff(current, desired *migrate.SchemaState) ([]migrate.Change, error)

Diff delegates to Differ.

func (*Migrator) InspectRealm

func (m *Migrator) InspectRealm(ctx context.Context) (*migrate.SchemaState, error)

InspectRealm delegates to Inspector.

func (*Migrator) InspectSchema

func (m *Migrator) InspectSchema(ctx context.Context, name string) (*migrate.Schema, error)

InspectSchema delegates to Inspector.

func (*Migrator) Lock

func (m *Migrator) Lock(ctx context.Context, name string, timeout time.Duration) (func() error, error)

Lock acquires a PostgreSQL advisory lock.

func (*Migrator) Plan

func (m *Migrator) Plan(ctx context.Context, name string, changes []migrate.Change) (*migrate.Plan, error)

Plan delegates to Planner.

type Planner

type Planner struct{}

Planner generates PostgreSQL DDL from a list of schema changes.

func NewPlanner

func NewPlanner() *Planner

NewPlanner returns a new Planner.

func (*Planner) Plan

func (p *Planner) Plan(_ context.Context, name string, changes []migrate.Change) (*migrate.Plan, error)

Plan converts a list of changes into a migration Plan.

Jump to

Keyboard shortcuts

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