Last active
October 20, 2016 12:18
-
-
Save rawkode/0a53874d45b08f60e7d8a33b49b0b2d7 to your computer and use it in GitHub Desktop.
Event Sourcing: Pattern Matching Event Handlers in Elixir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Domain.User do | |
def email_updated(%Event{ type: "UserUpdatedEmail", version: 1 } = event) | |
# do something with event | |
end | |
def email_updated(%Event{ type: "UserUpdatedEmail", version: 2 } = event) | |
# do something with event | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment