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

suite

package
v1.0.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package suite holds the integration tests every dialect must pass against a real database, so MySQL and Postgres behave the same.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(t *testing.T, d sql.Dialect, env string) *sql.DB

Open connects to the database in the environment variable env, or skips the test when it is not set, so `make test` needs no database.

func Run

func Run(t *testing.T, db *sql.DB, parentDDL, childDDL string)

Run runs the shared cases. ddl holds the dialect's CREATE TABLE statements for the parent and child tables, with %s for the table name suffix.

func RunRepository

func RunRepository(t *testing.T, db *sql.DB, ddl string)

RunRepository runs the Repository cases. ddl is the dialect's CREATE TABLE for Account, with %s for the table name: an auto increment id, a unique email, a name, and created_at and updated_at with microseconds.

Types

type Account

type Account struct {
	ID        int64     `db:"id,pk,auto"`
	Email     string    `db:"email"`
	Name      string    `db:"name"`
	CreatedAt time.Time `db:"created_at,created"`
	UpdatedAt time.Time `db:"updated_at,updated"`
}

Account is the entity of the repository cases.

Jump to

Keyboard shortcuts

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