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

extensiontest

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package extensiontest supplies isolated PostgreSQL model-store acceptance fixtures. No fixture drops schemas, resets data or starts a database server.

Index

Constants

This section is empty.

Variables

View Source
var Members = extensions.DefineORMOwner("members", orm.IdentityOf(memberFields.Table, memberFields.Key()), extensions.OwnerOptions{})
View Source
var Others = extensions.DefineORMOwner("others", orm.IdentityOf(otherFields.Table, otherFields.Key()), extensions.OwnerOptions{})
View Source
var Products = extensions.DefineORMOwner("products", orm.IdentityOf(products, products.Key()), extensions.OwnerOptions{})

Functions

func InterceptQueries

func InterceptQueries(base driver.Connector, failure func(string) error) driver.Connector

InterceptQueries injects a selected query failure while forwarding the real driver's execution and connection-lifetime interfaces used by the fixture.

func MemberIDField

func MemberIDField() orm.Key[Member, int64]

func MemberIdentity

func MemberIdentity(table string) orm.ModelIdentity[Member, int64]

MemberIdentity describes the member fixture model stored in table. Rename scenarios declare the same owner over a renamed table with it.

func MemberQuery

func MemberQuery() orm.Query[Member]

Types

type Fixture

type Fixture struct {
	DB      *database.DB
	Store   *extensions.Store
	Schema  string
	Queries *atomic.Int64
}

func Open

func Open(t testing.TB, definitions []migrate.Definition) Fixture

func OpenWithConnector

func OpenWithConnector(t testing.TB, definitions []migrate.Definition, wrap func(driver.Connector) driver.Connector) Fixture

OpenWithConnector permits a test to inject failures at the real driver boundary. The wrapper must preserve optional driver interfaces and own no credentials.

type Member

type Member struct {
	ID        int64
	DeletedAt value.Nullable[temporal.DateTime]
}

type Other

type Other struct {
	ID        int64
	DeletedAt value.Nullable[temporal.DateTime]
}

type Product

type Product struct{ SKU string }

Jump to

Keyboard shortcuts

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