postgres

package
v0.1.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 14 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

Overview

Package postgres restores Postgres dumps into throwaway containers.

Index

Constants

View Source
const (
	OldestMajor = 14
	NewestMajor = 18
)

Postgres major versions the runner restores into.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

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

Engine restores Postgres dumps.

func New

func New(client *docker.Client, limits docker.Limits) *Engine

New returns an engine that runs its containers through the given client, within the given limits.

func (*Engine) Cleanup

func (e *Engine) Cleanup(ctx context.Context, jobID string) error

Cleanup removes every container and volume of the job.

func (*Engine) DetectVersion

func (e *Engine) DetectVersion(ctx context.Context, jobID string, dump job.Dump) (job.Version, error)

DetectVersion reads the Postgres version from the dump, or falls back to the newest supported major.

func (*Engine) Ready

func (e *Engine) Ready(ctx context.Context) error

Ready reports whether Docker can be used.

func (*Engine) RemoveOrphans

func (e *Engine) RemoveOrphans(ctx context.Context, keepJobIDs ...string) error

RemoveOrphans removes what earlier runs left behind, except what belongs to the given jobs.

func (*Engine) Start

func (e *Engine) Start(ctx context.Context, jobID string, version job.Version) (job.Instance, error)

Start launches the container that the dump is restored into.

type Instance

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

Instance is a running throwaway Postgres server.

func (*Instance) LatestTimestamp

func (i *Instance) LatestTimestamp(ctx context.Context, check job.TimestampCheck) (job.TimestampReading, error)

LatestTimestamp reads the newest value in the chosen column.

func (*Instance) Major

func (i *Instance) Major() int

Major returns the Postgres major version of the server.

func (*Instance) Restore

func (i *Instance) Restore(ctx context.Context, dump job.Dump) error

Restore loads the dump into the throwaway database.

func (*Instance) Tables

func (i *Instance) Tables(ctx context.Context, estimate bool) ([]job.TableCount, error)

Tables counts the rows of every restored table, or estimates them for very large tables.

Jump to

Keyboard shortcuts

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