sqlitetest

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 13 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 sqlitetest seeds a store with raw SQL in tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func At added in v0.3.0

func At(t testing.TB, path string, version uint32, seed ...string)

At creates a store at path from the frozen schema of a released version and runs seed on it with that version's columns, leaving it at that version.

func Exec

func Exec(t testing.TB, db *sqlite.DB, query string, args ...any) sql.Result

Exec runs one statement in its own write transaction and fails t on error. It notes nothing.

func Migrated added in v0.2.0

func Migrated(t testing.TB, path string, version uint32, seed ...string) *sqlite.DB

Migrated creates a store at path from the frozen schema of a released version, runs seed on it with that version's columns, then migrates it with this release and opens it.

func Open

func Open(path string, log sqlite.Noter) (*sqlite.DB, error)

Open is sqlite.Open, except that a store absent at path starts as a copy of an empty store made once per test binary: creating the schema costs a tenth of a second under -race, and a package with hundreds of stores spends minutes on it.

func WriteLockHeld

func WriteLockHeld(t *testing.T, path string) bool

WriteLockHeld says whether a second connection to the database at path, with no busy timeout, is refused a write transaction.

Types

This section is empty.

Jump to

Keyboard shortcuts

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