Documentation
¶
Overview ¶
Package factory builds deterministic test data without requiring an ORM.
Index ¶
- type Builder
- type Factory
- func (f *Factory[T]) Build(states ...State[T]) T
- func (f *Factory[T]) BuildN(count int, states ...State[T]) ([]T, error)
- func (f *Factory[T]) Create(ctx context.Context, persist Persister[T], states ...State[T]) (T, error)
- func (f *Factory[T]) CreateN(ctx context.Context, count int, persist Persister[T], states ...State[T]) ([]T, error)
- type Persister
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Factory ¶
type Factory[T any] struct { // contains filtered or unexported fields }
Factory builds values from a concurrency-safe sequence.
func New ¶
New creates a factory whose first sequence number is 1.
It panics when builder is nil because a factory without a definition is a programming error.
func NewSequence ¶
NewSequence creates a factory with an explicit first sequence number.
Click to show internal directories.
Click to hide internal directories.