Documentation
¶
Overview ¶
Package pgtest starts an ephemeral Postgres for tests via Testcontainers. Import only from _test.go files so production binaries do not link the Docker SDK.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DatabaseName ¶
DatabaseName turns tb.Name() into a Postgres identifier (≤63 chars).
Types ¶
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
Container is a running Postgres (Testcontainers or DATABASE_* from the environment).
func Start ¶
Start launches postgres:17 and registers container termination on tb.Cleanup. Without Docker the test is skipped, unless PGTEST_REQUIRE is truthy (then Fatal).
func StartOrEnv ¶
StartOrEnv uses DATABASE_* when DATABASE_HOST is set; otherwise Start.
Click to show internal directories.
Click to hide internal directories.