testdbhook

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package testdbhook lets a test wrap the driver connector testdb opens for it, so an internal helper can observe every statement the test's database sends. An attachment is scoped to one testing.TB and ends when that test ends, so tests that do not attach run exactly as before.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Attach

func Attach(t testing.TB, wrap Wrapper)

Attach routes the database testdb opens for t through wrap until t ends.

func Wrap

func Wrap(t testing.TB, inner driver.Connector) driver.Connector

Wrap returns inner, wrapped by the wrapper attached to t, or inner unchanged when none is attached.

Types

type Wrapper

type Wrapper func(inner driver.Connector) driver.Connector

Wrapper returns the connector to open in place of inner.

Jump to

Keyboard shortcuts

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