Help us shape the future of Go! Take the 2026 Go Developer Survey

dbtest

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package dbtest is the database conformance suite: the same schema, ORM, transaction and migration checks run against every dialect (SQLite in core, Postgres and others in their driver modules).

func TestConformance(t *testing.T) {
	db := open(t) // *database.DB for the dialect under test
	dbtest.Run(t, db)
}

Run creates and drops its own tables (prefixed "dbt_"), so point it at a throwaway database.

See https://github.com/AlexGalhardo/vukem/blob/main/docs/database.md.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(t *testing.T, db *database.DB)

Run executes the conformance suite against db. Subtests run in order and share tables, so they are not parallel.

Example

A driver module runs the suite from a test against a throwaway database.

package main

import (
	"testing"

	"github.com/AlexGalhardo/vukem/database"
	"github.com/AlexGalhardo/vukem/database/dbtest"
)

func main() {
	_ = func(t *testing.T) {
		t.Helper()

		db, err := database.Open(t.Context(), ":memory:")
		if err != nil {
			t.Fatal(err)
		}
		t.Cleanup(func() { _ = db.Close() })

		dbtest.Run(t, db)
	}
}

Types

This section is empty.

Jump to

Keyboard shortcuts

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