ditesting

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecCall

type ExecCall struct {
	Query         string
	Args          []any
	InTransaction bool
}

ExecCall captures an Exec invocation against the memory storage.

type MemoryStorage

type MemoryStorage struct {
	// contains filtered or unexported fields
}

MemoryStorage records generator storage interactions for assertions in tests.

func NewGeneratorContainer

func NewGeneratorContainer(cfg runtimeconfig.Config, opts ...di.Option) (*di.Container, *MemoryStorage, error)

NewGeneratorContainer creates a DI container configured with memory-based generator storage.

func NewMemoryStorage

func NewMemoryStorage() *MemoryStorage

NewMemoryStorage constructs a new in-memory storage adapter.

func (*MemoryStorage) Exec

func (m *MemoryStorage) Exec(_ context.Context, query string, args ...any) (interfaces.Result, error)

Exec records the executed statement.

func (*MemoryStorage) ExecCalls

func (m *MemoryStorage) ExecCalls() []ExecCall

ExecCalls returns a copy of recorded Exec calls.

func (*MemoryStorage) Query

func (m *MemoryStorage) Query(_ context.Context, query string, args ...any) (interfaces.Rows, error)

Query records the query and returns a stateless rows iterator.

func (*MemoryStorage) QueryCalls

func (m *MemoryStorage) QueryCalls() []QueryCall

QueryCalls returns a copy of recorded Query calls.

func (*MemoryStorage) Transaction

func (m *MemoryStorage) Transaction(_ context.Context, fn func(tx interfaces.Transaction) error) error

Transaction executes the provided function with a transactional view of the storage.

type QueryCall

type QueryCall struct {
	Query         string
	Args          []any
	InTransaction bool
}

QueryCall captures a Query invocation against the memory storage.

Jump to

Keyboard shortcuts

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