Help us shape the future of Go! Take the 2026 Go Developer Survey

go_pgdump

package
v2.4.6 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 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 Data

type Data struct {
	Out                  io.Writer
	Connection           *sql.DB
	WhereClauseForTables map[string]string
	IgnoreTables         []string
	// contains filtered or unexported fields
}

Data configures and drives a Postgres dump, mirroring the shape of pkg/util/mysql/go_mysqldump.Data.

func NewDumper

func NewDumper(db *sql.DB, out io.Writer) *Data

NewDumper registers a new dumper against an already-open connection.

func (*Data) Close

func (d *Data) Close() error

Close closes the dumper's output (if closable) and its DB connection.

func (*Data) Dump

func (d *Data) Dump() error

Dump writes a complete, replayable SQL dump of the database to d.Out.

Phases, in order: (1) DROP + CREATE TABLE for every table (columns only - no constraints yet), (2) COPY data for every table, (3) PK, then UNIQUE constraints, then secondary indexes, then CHECK constraints, then FOREIGN KEY constraints last (deferred so referenced tables/rows already exist and no cross-table topological sort is needed), (4) sequence `setval` restoration. This mirrors real pg_dump's schema/data/post-data staging.

Jump to

Keyboard shortcuts

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