Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Begin ¶
Begin opens a transaction-scoped sandbox against a SQLite (or libSQL) engine: every write made through the returned *drel.Tx is rolled back when the test completes, giving per-test isolation without recreating the schema. Unlike a raw SAVEPOINT through the connection pool, this drives the engine's own single-connection transaction, so isolation holds for file-backed SQLite too (not just in-memory). Begin fails the test on a non-SQLite engine.
func CreateSchema ¶ added in v0.5.0
CreateSchema executes each DDL statement against the engine in order, failing the test on the first error. Convenience for tests that already hold an engine (it is the helper the PRD's hand-waved createSchema(t, engine) refers to).
Types ¶
type Option ¶
type Option func(*config)
Option configures NewSQLite.
func WithMigrations ¶ added in v0.5.0
WithMigrations applies all pending up-migrations from dir against the test engine. The migration files must be written for SQLite (the test engine's dialect); see CreateSchema for raw-DDL setup.
func WithSchema ¶ added in v0.5.0
WithSchema applies raw DDL statements (e.g. CREATE TABLE) after the database is created, each in order. A failing statement fails the test.