Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSQLiteDB ¶
NewSQLiteDB initializes a new instance of *bun.DB, which is ready for use (all required migrations are applied). Data is stored in memory (https://www.sqlite.org/inmemorydb.html).
Types ¶
type Postgres ¶
type Postgres struct {
// contains filtered or unexported fields
}
func NewPostgres ¶
func NewPostgres(pool *dockertest.Pool, opts ...PostgresOption) (*Postgres, error)
NewPostgres constructs a new Postgres resource. If the env variable 'TESTS_POSTGRES_CONNECTION_STRING' is set, this function doesn't run a new Docker container and uses the value of this variable as a connection string, otherwise this function runs a new PostgresSQL database in a Docker container. This function is intended for use in TestMain.
func (*Postgres) NewDB ¶
NewDB initializes a new instance of *bun.DB, which is ready for use (all required migrations are applied). This method guarantees data separation through PostgresSQL schemas (https://www.postgresql.org/docs/current/ddl-schemas.html) and it is safe to call postgres.NewDB multiple times.
It fails if Postgres hasn't been properly initialized (via NewPostgres).
type PostgresOption ¶
type PostgresOption func(cfg *postgresConfig)
func WithPostgresImage ¶
func WithPostgresImage(image string) PostgresOption
func WithPostgresTTL ¶
func WithPostgresTTL(ttlSeconds uint) PostgresOption