testdb

package
v0.0.0-...-fad6b96 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyMigrations

func ApplyMigrations(db *sql.DB, base string, corpora ...string) (err error)

ApplyMigrations will apply the migrations to the given db. If corpus does not start with a "/" then base will be prepended to it. Otherwise the corpus will be used as is.

func InitFilename

func InitFilename(filename, base string, corpora ...string) (db *sql.DB, err error)

InitFilename will init the sqlite3 database with the corpus migrations applied to it. If corpus does not start with a "/" then base will be prepended to it. Otherwise the corpus will be used as is.

func New

func New(t *testing.T, shouldCleanup *bool, base string, corpora ...string) (name string, cleanup func(), db *sql.DB)

New will create a new database with the corpus migrations applied to it. If corpus does not start with a "/" then base will be prepended to it. Otherwise the corpus will be used as is.

func NewFilename

func NewFilename(t *testing.T, cleanup *bool) (string, func())

NewFilename will generate a new file that can be used for the database, and provide a cleanup function to remove the file after it's no longer needed. cleanup can be passed; which will tell the cleanup functions weather or not to delete the file. This is handy for debugging. Where you want a failed to test to print out the file name, so that the developer can inspect it later.

Types

This section is empty.

Jump to

Keyboard shortcuts

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