database

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package database provides database functions for Animanager.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(ctx context.Context, dataSrc string) (db *sql.DB, err error)

Open opens and returns the SQLite database. The database is migrated to the newest version.

func OpenMem

func OpenMem(t T) *sql.DB

OpenMem opens and returns a SQLite database from memory for testing.

The database is migrated to the newest version.

Note that the memory database is shared between all concurrent connections. Thus, this function holds a mutex. This function registers test cleanup functions to close the database and unlock the mutex.

Types

type T added in v0.21.0

type T interface {
	Cleanup(func())
	Fatal(args ...any)
}

A T has the interface provided by testing.T and related types.

Directories

Path Synopsis
Package migrate implements migrations for the Animanager SQLite database.
Package migrate implements migrations for the Animanager SQLite database.

Jump to

Keyboard shortcuts

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