fake

package
v0.3.0-20260730213620-... Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

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

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 New

func New() *Resolver

New returns an empty fake Resolver. Seed it with Set / SetDetailed.

func (*Resolver) ChangesForBatch

func (r *Resolver) ChangesForBatch(_ context.Context, batch entity.Batch) ([]change.Change, error)

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) FailWith

func (r *Resolver) FailWith(err error) *Resolver

FailWith makes every Changes and Detailed call return err.

func (*Resolver) Set

func (r *Resolver) Set(batchID string, changes ...change.Change) *Resolver

Set seeds the raw changes returned by Changes for the given batch ID.

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.

Jump to

Keyboard shortcuts

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