Help us shape the future of Go! Take the 2026 Go Developer Survey

dbtest

package
v0.1.57 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTempSQLiteDB

func CreateTempSQLiteDB(t *testing.T, prefix string) (*sql.DB, string, func())

CreateTempSQLiteDB creates a temporary SQLite database file and opens a connection. It returns the *sql.DB, its path, and a cleanup function that closes the DB and removes the temp directory.

func ExecAll

func ExecAll(t *testing.T, db *sql.DB, items []ParameterizedSQL)

ExecAll executes statements sequentially, failing the test on first error.

func LoadDDLFromFile

func LoadDDLFromFile(t *testing.T, db *sql.DB, path string)

LoadDDLFromFile reads a DDL file and executes contained statements separated by ';'.

func LoadSQLiteSchema

func LoadSQLiteSchema(t *testing.T, db *sql.DB)

LoadSQLiteSchema loads the embedded SQLite schema DDL and executes it.

Types

type ParameterizedSQL

type ParameterizedSQL struct {
	SQL    string
	Params []interface{}
}

ParameterizedSQL represents a statement with optional parameters.

Jump to

Keyboard shortcuts

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