extensiontest

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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.Table, 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] `foundry:"role=soft-delete"`
}

type MemberTable added in v0.51.0

type MemberTable struct {
	// See [Member.ID].
	orm.Table[Member, int64]
	// See [Member.DeletedAt].
	DeletedAt orm.SoftDelete[Member, temporal.DateTime]
	// See [Member.DeletedAt].
	Soft orm.SoftDeletable[Member]
}

MemberTable binds the declared fields of Member.

type Other

type Other struct {
	ID        int64
	DeletedAt value.Nullable[temporal.DateTime] `foundry:"role=soft-delete"`
}

type OtherTable added in v0.51.0

type OtherTable struct {
	// See [Other.ID].
	orm.Table[Other, int64]
	// See [Other.DeletedAt].
	DeletedAt orm.SoftDelete[Other, temporal.DateTime]
	// See [Other.DeletedAt].
	Soft orm.SoftDeletable[Other]
}

OtherTable binds the declared fields of Other.

type Product

type Product struct{ SKU string }

type ProductTable added in v0.51.0

type ProductTable struct {
	// See [Product.SKU].
	orm.Table[Product, string]
}

ProductTable binds the declared fields of Product.

Jump to

Keyboard shortcuts

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