Skip to content

Conversation

@joaobalsini
Copy link
Collaborator

@joaobalsini joaobalsini commented Oct 18, 2022

Before this PR, a user could only compare aggregate state before the multi start with the aggregate state on the current step.

This PR allows a user to record aggregate state under a name for each of the multi steps (after the step has been processed in the aggregate) and later compare it with the aggregate state before the multi started or after any of the previous steps.

This helps on some complex cases multis, in which we need to know what changes were applied on previous steps of the multi.

This code change doesn't deprecate current functionality.

Example

      aggregate
      |> Multi.new()
      |> Multi.execute(:interesting_event, fn aggregate ->
        %Event{data: 1}
      end)
      |> Multi.execute(fn aggregate, %{interesting_event: _aggregate_after_interesting_event} ->
        %Event{data: 2}
      end)

@joaobalsini joaobalsini changed the title Multi with named steps Multi with named steps on top of our fork Oct 18, 2022
@joaobalsini joaobalsini requested review from dmnelson and juggy October 18, 2022 16:43
@joaobalsini joaobalsini self-assigned this Oct 18, 2022
@joaobalsini joaobalsini changed the title Multi with named steps on top of our fork Record aggregate state while processing Multi (on top of our fork) Oct 18, 2022
@dmnelson dmnelson removed request for dmnelson and juggy March 4, 2024 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants