dbtest

package
v0.2.65 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 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 added in v0.2.38

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