Documentation
¶
Overview ¶
Package fake provides an in-memory changeset.Resolver for tests and examples. Seed per-batch results with Set (raw changes) and SetDetailed (detailed view), keyed by batch ID; the resolver serves what was seeded. A batch with no seeded entry resolves to empty rather than an error, matching a batch whose requests carry no changes. FailWith injects an error on every call to exercise the error path without a real store. It is intended for examples and tests only, never production.
Index ¶
- type Resolver
- func (r *Resolver) ChangesForBatch(_ context.Context, batch entity.Batch) ([]change.Change, error)
- func (r *Resolver) DetailedForBatch(_ context.Context, batch entity.Batch) (entity.BatchChanges, error)
- func (r *Resolver) FailWith(err error) *Resolver
- func (r *Resolver) Set(batchID string, changes ...change.Change) *Resolver
- func (r *Resolver) SetDetailed(batchID string, detailed entity.BatchChanges) *Resolver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver is a programmable in-memory changeset.Resolver.
func (*Resolver) ChangesForBatch ¶
ChangesForBatch returns the seeded raw changes for the batch, in seeded order. An unseeded batch resolves to a nil slice.
func (*Resolver) DetailedForBatch ¶
func (r *Resolver) DetailedForBatch(_ context.Context, batch entity.Batch) (entity.BatchChanges, error)
DetailedForBatch returns the seeded detailed view for the batch. An unseeded batch resolves to an empty entity.BatchChanges carrying the batch's identity.
func (*Resolver) SetDetailed ¶
func (r *Resolver) SetDetailed(batchID string, detailed entity.BatchChanges) *Resolver
SetDetailed seeds the detailed view returned by Detailed for the given batch ID.