Documentation
¶
Overview ¶
Package util provides test utilities and helper functions for database testing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddSearchPathToConnString ¶
AddSearchPathToConnString appends search_path parameter to a PostgreSQL connection string. This ensures all connections in the pool use the specified schema. Includes "public" so that extension types (e.g. pgvector's "vector") installed in the public schema remain visible.
func GenerateSchemaName ¶
GenerateSchemaName creates a unique, PostgreSQL-safe schema name for the test. Format: test_<sanitized_test_name>_<random_hex>
func GetBaseConnectionString ¶
GetBaseConnectionString returns the base PostgreSQL connection string (without schema search_path). Used by integration tests that need a raw connection string for dedicated connections, e.g. NotifyListener's pgx.Conn.
func SetupTestDatabase ¶
SetupTestDatabase creates a test database and returns the raw components. Both CI and local dev use per-test schemas for isolation and scalability. - CI: Connects to external PostgreSQL service container - Local: Uses a shared testcontainer (started once per package) Returns the ent client and database connection for wrapping by the caller.
Types ¶
This section is empty.