dbtest

package
v0.0.0-...-c396cca Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package dbtest contains database utilities for use in tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func First

func First(t *testing.T, tx *gorm.DB, dest any, conds ...any)

First calls tx.First() and fails the test if it fails.

func InMemory

func InMemory(t *testing.T) *gorm.DB

InMemory create a disposable in-memory SQLite database.

Each call returns a distinct, unique database, which is closed at the end of the test. See https://www.sqlite.org/inmemorydb.html.

func Save

func Save(t *testing.T, tx *gorm.DB, values ...any)

Save calls tx.Save() and fails the test if it fails.

Types

This section is empty.

Jump to

Keyboard shortcuts

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