Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StopPostgresContainer ¶
func StopPostgresContainer( ctxStop context.Context, pgContainer *PostgresContainer, ) error
StopPostgresContainer stops a PostgreSQL container.
Types ¶
type PostgresContainer ¶
type PostgresContainer struct {
*tcpostgres.PostgresContainer
// contains filtered or unexported fields
}
PostgresContainer represents a PostgreSQL container for testing.
func StartPostgresContainer ¶
func StartPostgresContainer(ctx context.Context) (*PostgresContainer, error)
StartPostgresContainer starts a new PostgreSQL container using testcontainers.
func (*PostgresContainer) CreateDB ¶
func (c *PostgresContainer) CreateDB( ctx context.Context, t *testing.T, ) (contract.DB, func(), error)
CreateDB creates a new isolated database cloned from the template. It returns the pgx connection, cleanup function, and any error.
func (*PostgresContainer) SetupTemplateDB ¶
func (c *PostgresContainer) SetupTemplateDB( ctx context.Context, dbNameTemplate string, schemaDDL string, ) error
SetupTemplateDB creates a template database with the initial schema DDL.
Click to show internal directories.
Click to hide internal directories.