Documentation
¶
Overview ¶
Package requires checks a plugin's requires.postgres_extensions against the project's Postgres before the plugin is downloaded (P7-ADOPT-06).
Purpose: a plugin such as claw needs the `vector` extension; on a cluster without it the install used to fail deep inside the plugin's boot migrations. Check refuses up front with E507 and the fix, installing nothing. Inputs: the project config, the extension names from the manifest, a Probe (nil selects the Docker probe). Outputs: nil, or an *errs.CLIError E507. A custom image whose contents are unknown yields only an E508 warning on Stderr. A database that is running but cannot be queried is a plain error, never a false "missing". Constraints: read-only (never creates or enables an extension); extension names are validated against nameRE and are never placed in SQL: the probe lists pg_available_extensions and the comparison happens here.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Stderr io.Writer = os.Stderr
Stderr receives the E508 warning. Tests replace it.
Functions ¶
Types ¶
type Probe ¶
type Probe interface {
// Running reports whether the project's postgres container is running.
Running(ctx context.Context) (bool, error)
// Available returns the extension names the running server can create.
Available(ctx context.Context) (map[string]bool, error)
}
Probe reports on the live cluster.
var DefaultProbe Probe
DefaultProbe replaces the Docker probe when Check gets a nil Probe. It is a test seam and stays nil in production.
func DockerProbe ¶
DockerProbe returns the default probe for cfg; the integration test uses it against a container it started.