dbtest

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartDB

func StartDB() (*docker.Container, error)

StartDB starts a database instance.

func StopDB

func StopDB(c *docker.Container)

StopDB stops a running database instance.

Types

type Test

type Test struct {
	DB       *sqlx.DB
	Log      *otelzap.Logger
	Teardown func()
	// contains filtered or unexported fields
}

Test owns state for running and shutting down tests.

func NewTest

func NewTest(t *testing.T, c *docker.Container) *Test

NewTest creates a test database inside a Docker container. It creates the required table structure but the database is otherwise empty. It returns the database to use as well as a function to call at the end of the test.

Jump to

Keyboard shortcuts

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