dbengine

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: MIT Imports: 4 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 dbengine describes how each supported engine is probed, dumped and restored. Every argv runs inside the database container through `docker compose exec -T`, wrapped in `sh -c` where a credential must expand there.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsFileBased

func IsFileBased(name string) bool

func Names

func Names() []string

func TempDBName

func TempDBName(project string) string

TempDBName keeps the throwaway database identifier valid unquoted in every engine: my-app would not be.

func Valid

func Valid(name string) bool

Valid reports whether name designates a supported engine, file-based ones included. The empty name is the postgres default.

Types

type Engine

type Engine interface {
	Name() string
	// DetectImage reports whether this engine runs the given image repo
	// (already lowercased and stripped of tag and digest).
	DetectImage(repo string) bool
	// ReadyArgs succeeds once the server accepts connections.
	ReadyArgs(user string) []string
	DropTempDBArgs(user, db string) []string
	// CreateTempDBArgs is nil for engines creating databases implicitly.
	CreateTempDBArgs(user, db string) []string
	// DumpArgs writes the dump of db to stdout.
	DumpArgs(user, db string) []string
	// ObjectCountArgs writes to stdout how many tables, or collections, db
	// holds. A migration that never targeted the throwaway database leaves it
	// at zero, which is the only way to tell that dump from a real one.
	ObjectCountArgs(user, db string) []string
	// RestoreScript is the docker-entrypoint-initdb.d body restoring the dump.
	RestoreScript(project string) string
}

func ByName

func ByName(name string) (Engine, error)

ByName resolves an engine; the empty name is postgres, which is what every project registered before db_engine existed means.

func Detect

func Detect(image string) (Engine, bool)

Detect finds the engine running a compose image, e.g. "postgres:16-alpine".

Jump to

Keyboard shortcuts

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