sqlitetest

package
v0.99.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package sqlitetest opens in-memory SQLite databases for unit tests using modernc.org/sqlite.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenClient

func OpenClient(t *testing.T, dbName string) *gen.Client

OpenClient opens a private in-memory SQLite database and returns an ent client with schema applied. dbName is a caller hint only; a unique suffix is always appended so shared-memory SQLite databases never collide across parallel tests or -count>1 (raw CREATE TABLE is not idempotent).

Schema is materialized once into a temp-file template, then each OpenClient clones it via SQLite's Online Backup API (NewRestore). Replaying hundreds of DDL statements under -race (or calling Atlas Schema.Create per test) is prohibitively slow for packages such as internal/modules/web.

Types

This section is empty.

Jump to

Keyboard shortcuts

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