diff

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: MIT Imports: 35 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const CREATE_TEMPLATE = "CREATE DATABASE contrib_regression TEMPLATE postgres"

Required to bypass pg_cron check: https://github.com/citusdata/pg_cron/blob/main/pg_cron.sql#L3

Variables

This section is empty.

Functions

func ConnectShadowDatabase

func ConnectShadowDatabase(ctx context.Context, timeout time.Duration, options ...func(*pgx.ConnConfig)) (conn *pgx.Conn, err error)

func CreateShadowDatabase

func CreateShadowDatabase(ctx context.Context, port uint16) (string, error)

func DiffDatabase

func DiffDatabase(ctx context.Context, schema []string, config pgconn.Config, w io.Writer, fsys afero.Fs, differ DiffFunc, usePgDelta bool, options ...func(*pgx.ConnConfig)) (string, error)

func DiffPgDelta

func DiffPgDelta(ctx context.Context, source, target pgconn.Config, schema []string, options ...func(*pgx.ConnConfig)) (string, error)

DiffPgDelta diffs source and target Postgres configs via pg-delta.

This wrapper preserves the old config-based interface while delegating to DiffPgDeltaRef, which also supports catalog-file references. Format options are read from config so DiffFunc callers do not need to change.

func DiffPgDeltaRef

func DiffPgDeltaRef(ctx context.Context, sourceRef, targetRef string, schema []string, formatOptions string, options ...func(*pgx.ConnConfig)) (string, error)

DiffPgDeltaRef supports pg-delta diffing across both live database URLs and on-disk catalog references used by declarative sync commands. formatOptions is passed through as FORMAT_OPTIONS to the pg-delta script when non-empty.

func DiffPgSchema

func DiffPgSchema(ctx context.Context, source, target pgconn.Config, schema []string, _ ...func(*pgx.ConnConfig)) (string, error)

func DiffSchemaMigra

func DiffSchemaMigra(ctx context.Context, source, target pgconn.Config, schema []string, options ...func(*pgx.ConnConfig)) (string, error)

func DiffSchemaMigraBash

func DiffSchemaMigraBash(ctx context.Context, source, target pgconn.Config, schema []string, options ...func(*pgx.ConnConfig)) (string, error)

Diffs local database schema against shadow, dumps output to stdout.

func DiffSchemaPgAdmin

func DiffSchemaPgAdmin(ctx context.Context, source, target string, schema []string, p utils.Program) (string, error)

func ExportCatalogPgDelta

func ExportCatalogPgDelta(ctx context.Context, targetRef, role string, options ...func(*pgx.ConnConfig)) (string, error)

ExportCatalogPgDelta snapshots a database/catalog into serialized pg-delta catalog JSON so later operations can diff without reconnecting.

func MigrateShadowDatabase

func MigrateShadowDatabase(ctx context.Context, container string, fsys afero.Fs, options ...func(*pgx.ConnConfig)) error

func Run

func Run(ctx context.Context, schema []string, file string, config pgconn.Config, differ DiffFunc, usePgDelta bool, fsys afero.Fs, options ...func(*pgx.ConnConfig)) (err error)

func RunExplicit

func RunExplicit(ctx context.Context, fromRef, toRef string, schema []string, outputPath string, fsys afero.Fs, options ...func(*pgx.ConnConfig)) error

func RunPgAdmin

func RunPgAdmin(ctx context.Context, schema []string, file string, config pgconn.Config, fsys afero.Fs) error

func SaveDiff

func SaveDiff(out, file string, fsys afero.Fs) error

Types

type DeclarativeFile

type DeclarativeFile struct {
	Path       string `json:"path"`
	Order      int    `json:"order"`
	Statements int    `json:"statements"`
	SQL        string `json:"sql"`
}

DeclarativeFile mirrors the per-file payload returned by pg-delta declarative export so the CLI can materialize structured SQL files on disk.

type DeclarativeOutput

type DeclarativeOutput struct {
	Version int               `json:"version"`
	Mode    string            `json:"mode"`
	Files   []DeclarativeFile `json:"files"`
}

DeclarativeOutput is the top-level declarative export envelope emitted by the pg-delta script and consumed by db/declarative workflows.

func DeclarativeExportPgDelta

func DeclarativeExportPgDelta(ctx context.Context, source, target pgconn.Config, schema []string, formatOptions string, options ...func(*pgx.ConnConfig)) (DeclarativeOutput, error)

DeclarativeExportPgDelta exports target schema as declarative file payloads while keeping a config-based API for existing call sites.

func DeclarativeExportPgDeltaRef

func DeclarativeExportPgDeltaRef(ctx context.Context, sourceRef, targetRef string, schema []string, formatOptions string, options ...func(*pgx.ConnConfig)) (DeclarativeOutput, error)

DeclarativeExportPgDeltaRef exports declarative file payloads using either live URLs or catalog references as source/target inputs.

type DiffFunc

type DiffFunc func(context.Context, pgconn.Config, pgconn.Config, []string, ...func(*pgx.ConnConfig)) (string, error)

Jump to

Keyboard shortcuts

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