pgdump

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FixedRestrictKey is a constant restricted key that can be used for tests and other use cases where
	// a constant restrict key is needed.
	FixedRestrictKey = "pgschemadiffrestrict"
)

Variables

This section is empty.

Functions

func GetDump

func GetDump(db *pgengine.DB, additionalParams ...Parameter) (string, error)

GetDump gets the pg_dump of the inputted database. It is only intended to be used for testing. You cannot securely pass passwords with this implementation, so it will only accept databases created for unit tests (spun up with the pgengine package) "pgdump" must be on the system's PATH

func GetDumpUsingBinary

func GetDumpUsingBinary(pgDumpBinaryPath string, db *pgengine.DB, additionalParams ...Parameter) (string, error)

func ParseVersion added in v1.0.2

func ParseVersion(versionString string) (*version.Version, error)

ParseVersion parses a version string from pg_dump output and returns a Version object. This function is exported to make it testable.

Types

type Parameter

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

Parameter represents a parameter to be pg_dump. Don't use a type alias for a string slice because all parameters for pgdump should be explicitly added here

func WithExcludeSchema

func WithExcludeSchema(pattern string) Parameter

func WithRestrictKey added in v1.0.2

func WithRestrictKey(restrictKey string) Parameter

WithRestrictKey is used by PSQL to prevent injection of "meta" commands. If not explicitly provided, a random one will be generated for each pg_dump run. This most likely needs to be fixed for any usages of pg_dump in tests.

func WithSchemaOnly

func WithSchemaOnly() Parameter

Jump to

Keyboard shortcuts

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