Skip to content

Instantly share code, notes, and snippets.

@rawkode
Last active October 20, 2016 12:18
Show Gist options
  • Save rawkode/0a53874d45b08f60e7d8a33b49b0b2d7 to your computer and use it in GitHub Desktop.
Save rawkode/0a53874d45b08f60e7d8a33b49b0b2d7 to your computer and use it in GitHub Desktop.
Event Sourcing: Pattern Matching Event Handlers in Elixir
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