Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Record aggregate state while processing Multi (on top of our fork) #3

Open
wants to merge 3 commits into
base: snapshot-improvement-1-3-1
Choose a base branch
from

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 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
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.

1 participant