Evaluates the supported subset of a Chronicle.ReadModels.ReadModel's embedded
projection declarations against events, in memory — for a spec that wants to
assert on a projected read model without a kernel to run the real projection
engine.
Supports from/2 (:set, :add, :subtract, :count, :increment,
:decrement, :clear) and auto-map, plus removed_with/2.
join/2, children/2, from_every/1, removed_with_join/2 and their
variants need the server-side projection engine and raise
Chronicle.Testing.UnsupportedProjectionOperation — point a spec at a real
kernel through Chronicle.Testing.Integration.setup_isolated_client/2 instead.
Summary
Functions
Applies event (appended for event_source_id) to instance (or nil, for a
new instance) according to read_model_module's from/2 and removed_with/2
declarations.
Functions
@spec apply_event(module(), struct() | nil, struct(), String.t()) :: {:ok, struct() | nil} | :removed
Applies event (appended for event_source_id) to instance (or nil, for a
new instance) according to read_model_module's from/2 and removed_with/2
declarations.
Returns {:ok, instance}, {:ok, nil} when no from/2 matches the event (the
instance is returned unchanged), or :removed when a removed_with/2 matches.