Documentation ¶
Index ¶
- func WithLifecycle(...) func(*DB)
- func WithPublication(name string) func(*DB)
- func WithPublicationClean(name string) func(*DB)
- func WithReplicationSlotClean(prefix string) func(*DB)
- func WithSchema(name string) func(*DB)
- func WithTable(namespace string, name string, fieldDefinitions ...string) func(*DB)
- func WithTruncate(namespace, name string) func(*DB)
- type DB
- func (d *DB) GetConnection(ctx context.Context) *pgx.Conn
- func (d *DB) GetDB() *sql.DB
- func (d *DB) GetReplicationConnection(ctx context.Context) *pgx.Conn
- func (d *DB) MustExec(ctx context.Context, query string, args ...interface{})
- func (d *DB) Setup(ctx context.Context, timeout time.Duration) (context.Context, func())
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithLifecycle ¶
func WithPublication ¶
func WithPublicationClean ¶
func WithSchema ¶
func WithTruncate ¶
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is used to help test interactions with Postgres. Unlike a conventional application, we create global state that lives outside of a schema, and require creation of tables with arbitrary schemas. We also reach deeper into the connection pools than most, requiring us to explicitly close any connections we create.
This test helper can be used to ensure connections are closed, and test structure clean-up happens reliably.
func (*DB) GetConnection ¶
func (*DB) GetReplicationConnection ¶
Click to show internal directories.
Click to hide internal directories.