scripts

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package scripts holds operational commands that run pg_dump and other external tooling on behalf of the appximo engine (CLI `appximo backup` and the admin /admin/backup endpoint).

Index

Constants

This section is empty.

Variables

View Source
var ErrPgDumpNotFound = errors.New("pg_dump not found in PATH")

ErrPgDumpNotFound is returned (wrapped) when the pg_dump binary is not on PATH, so callers (the HTTP endpoint) can map it to 503 instead of a generic 500.

Functions

func RunBackup

func RunBackup(ctx context.Context, pool *pgxpool.Pool, tenantID, outputDir string) error

RunBackup is the CLI entrypoint: dumps one tenant (or all tenants when tenantID is empty) into outputDir, printing one line per completed dump.

Types

type BackupResult

type BackupResult struct {
	Tenant    string `json:"tenant"`
	Path      string `json:"path"`
	SizeBytes int64  `json:"size_bytes"`
}

BackupResult describes one completed schema dump.

func Backup

func Backup(ctx context.Context, pool *pgxpool.Pool, tenantID, outputDir string) ([]BackupResult, error)

Backup dumps one tenant (tenantID set) or every tenant (tenantID empty) and returns a result per schema. Uses the production pg_dump runner.

type DumpRunner

type DumpRunner interface {
	Dump(ctx context.Context, schemaName, connStr, outPath string) error
}

DumpRunner abstracts the pg_dump invocation so tests can substitute a fake and avoid shelling out to a real binary.

Jump to

Keyboard shortcuts

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