testdb

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package testdb creates isolated databases for integration tests. It must not be imported by application code. Both backends apply published package templates with Goose.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(t *testing.T, cfg database.Config)

Migrate prepares a disposable integration database using package templates.

func Migrations

func Migrations(t *testing.T, driver database.Driver) fs.FS

Migrations publishes the package templates into a temporary directory. Test versions are fixed so fixtures are independent of the application's opt-in SQL.

func Open

func Open(t *testing.T) *bun.DB

func OpenDriver

func OpenDriver(t *testing.T, driver database.Driver) *bun.DB

func RateLimiter

func RateLimiter(t testing.TB) ratelimit.Limiter

RateLimiter uses a disposable Redis backend and a unique namespace per fixture. Keys expire automatically; never flush a database shared by parallel tests.

Types

This section is empty.

Jump to

Keyboard shortcuts

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