dbtest

package
v0.0.0-...-9358009 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package dbtest exercises Bun-backed repositories and services against a real Postgres database, rolling back every test's outer transaction so nothing is left behind.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DSN

func DSN(t *testing.T) string

DSN returns DATABASE_URL for a test that needs a real Postgres. It skips t unless ENV is test, so a bare `go test` in a dev shell never touches the dev database, and fails t if the database name does not end in _test.

func New

func New(t *testing.T) (bun.IDB, database.Transactor)

New opens an outer transaction against DSN(t), returned as a bun.IDB plus a Transactor built on it via SAVEPOINTs; both are rolled back automatically via t.Cleanup.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址