inspecttest

package
v0.5.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: PostgreSQL Imports: 8 Imported by: 0

Documentation

Overview

Package inspecttest is a database/sql driver that answers queries from a script, so a command that runs an inspect analysis can be tested without a Postgres.

Index

Constants

View Source
const DriverName = "inspectfake"

DriverName is the name the fake is registered under.

Variables

This section is empty.

Functions

func Open

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

Open returns a *sql.DB on the fake, closed when the test ends.

func Opener

func Opener(t *testing.T, seen *string) func(context.Context, string) (*sql.DB, error)

Opener is an inspect opener that ignores the URL and returns the fake, recording the URL it was handed.

func Script

func Script(t *testing.T, key string, r Result)

Script registers an answer for statements containing key, for the life of the test.

Types

type Result

type Result struct {
	Cols []string
	Rows [][]driver.Value
	Err  error
}

Result is one scripted answer: the columns and rows to return, or the error to fail with.

Jump to

Keyboard shortcuts

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