Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Database user for connecting to the database instances created from the template database.
User string
// Password for the database user.
Password string
// The name of the database which will be used as the template database.
Database string
// Image to use for the test container. Defaults to "postgres:17.2"
Image string
// MaxConnections to the database. Defaults to 1000.
MaxConnections int
// Path to migrations/seeding directory. Will ignore if empty.
MigrationsPath string
// Path to seeding directory. Will ignore if empty.
SeedPath string
// Seed func to run after migrations. Will ignore if empty.
SeedFunc func(db *sql.DB, connStr string) error
// Logger for logging the test container's output. Useful for debugging. Default to testcontainer's noopLogger
Logger *slog.Logger
// contains filtered or unexported fields
}
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
func NewContainer ¶
NewContainer launches a postgres test container and sets up the template database.
func (*Container) CloseInstance ¶
func (c *Container) CloseInstance(ctx context.Context, di *DatabaseInstance) error
Close will close the connection to the database for the single test instance and drop the database
func (*Container) NewInstance ¶
func (c *Container) NewInstance(ctx context.Context) (*DatabaseInstance, error)
NewInstance clones the template database to setup a database scoped to a single test
type DatabaseInstance ¶
type SlogAdapter ¶ added in v0.0.3
type SlogAdapter struct {
// contains filtered or unexported fields
}
func (*SlogAdapter) Printf ¶ added in v0.0.3
func (s *SlogAdapter) Printf(format string, v ...any)
Click to show internal directories.
Click to hide internal directories.