database

package
v0.0.0-...-1dfb574 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, conf config.Config) (*sql.DB, error)

New creates a new SQLite database and runs all migrations

func SafeDefer

func SafeDefer(ctx context.Context, fn func() error)

SafeDefer calls the given function (typically a close/rollback) and logs if it returns an error. Designed to be used in defer statements.

func Test

func Test(t TestingLog) *sql.DB

Test creates a database for the given test. It does this by extracting the package under test, and creating and caching a database. If two tests call the Database method, only a single database is created.

Types

type TestingLog

type TestingLog interface {
	zerolog.TestingLog
	FailNow()
	Name() string
	Cleanup(func())
}

Jump to

Keyboard shortcuts

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