Documentation
¶
Overview ¶
Package postgres provides a generic testcontainers-based PostgreSQL database for integration tests.
It is deliberately schema-agnostic: it starts a real PostgreSQL container and exposes the DSN, but applies NO application schema (no ORM schema, no consumer tables). A caller that needs a schema provisions it over the DSN — e.g. River applies its own migration, and a consumer's schema fixture can wrap this to run its own migrations. Keeping this fixture generic is what lets the engine's client integration tests (River, etc.) run without any consumer schema.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TestDatabase ¶
type TestDatabase struct {
// contains filtered or unexported fields
}
TestDatabase wraps a testcontainers PostgreSQL instance. It holds no application schema — callers migrate over GetDSN() as needed.
func NewTestDatabase ¶
func NewTestDatabase(ctx context.Context) (*TestDatabase, error)
NewTestDatabase starts a PostgreSQL container and returns a TestDatabase whose DSN points at an empty database (no schema applied).
func (*TestDatabase) Close ¶
func (td *TestDatabase) Close(ctx context.Context)
Close terminates the container.
func (*TestDatabase) GetDSN ¶
func (td *TestDatabase) GetDSN() string
GetDSN returns the PostgreSQL connection string for direct SQL access.