testutil

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package testutil holds shared helpers for the test suite: currently a single migrate-and-open database fixture (NewDB). It is imported only from _test.go files, so the goose dependency it pulls in never reaches the runtime binary. It is carved out of the strict internal depguard rule for the same reason the domain package is: its allowed imports differ (goose and testify, neither of which belongs in production code).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDB

func NewDB(t *testing.T) *sql.DB

NewDB opens a fresh on-disk database in a temp directory and applies every migration from the repo's top-level migrations/ directory. The database is closed automatically when the test finishes.

The store package keeps its own copy of this helper: store's tests live in package store, and importing testutil (which imports store) from them would form an import cycle. Every other package uses NewDB.

Types

This section is empty.

Jump to

Keyboard shortcuts

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