Skip to content

Latest commit

 

History

History
56 lines (34 loc) · 2.45 KB

File metadata and controls

56 lines (34 loc) · 2.45 KB

AshEvents.Events

Defines the events section for a resource.

events

Examples

events do
  event_log MyApp.Events.EventLog
  ignore_actions [:create_old_v1, :update_old_v1, :update_old_v2, :destroy_old_v1]
  current_action_versions create: 2, update: 3, destroy: 2
end

events do
  event_log MyApp.Events.EventLog
  only_actions [:create, :update, :destroy]
  current_action_versions create: 2, update: 3, destroy: 2
  replay_non_input_attribute_changes [create_v1: :as_arguments, update_v2: :force_change]
end

Options

Name Type Default Docs
event_log{: #events-event_log .spark-required} module The event-log resource that creates and stores events.
only_actions{: #events-only_actions } list(atom) A list of actions that should be the only actions that have events created when run.
ignore_actions{: #events-ignore_actions } list(atom) [] A list of actions that should not have events created when run.
current_action_versions{: #events-current_action_versions } keyword [] A keyword list of action versions. This will be used to set the version in the created events when the actions are run. Version will default to 1 for all actions that are not listed here.
allowed_change_modules{: #events-allowed_change_modules } keyword [] A keyword list of action names and whitelisted change modules that should not be removed during event replay.
create_timestamp{: #events-create_timestamp } atom The name of the create timestamp attribute on the resource
update_timestamp{: #events-update_timestamp } atom The name of the update timestamp attribute on the resource
replay_non_input_attribute_changes{: #events-replay_non_input_attribute_changes } keyword [] Configure how non-input attribute changes are handled during replay for each action. Options are :force_change (apply via force_change_attributes) or :as_arguments (merge into action input). Defaults to :force_change for all actions.
<style type="text/css">.spark-required::after { content: "*"; color: red !important; }</style>