Arke.Hook (Arke v0.9.0-rc.3)

Copy Markdown View Source

Context token passed to every write-pipeline hook.

All handlers are arity-1 over the token and return {:ok, hook} or {:error, reason}. The operation, previous unit and failure reason are fields, not extra arguments: one signature everywhere. Mutating hook.unit before the write is how data transforms happen.

  • :op:create | :update | :delete

  • :arke — the arke definition unit
  • :group — the group definition unit, set while a group module's hooks run
  • :project — the project the write targets
  • :unit — the unit being written
  • :old_unit — the pre-update unit (:update only)
  • :error — the failure reason (after_rollback only)

Summary

Types

op()

@type op() :: :create | :update | :delete

t()

@type t() :: %Arke.Hook{
  arke: Arke.Core.Unit.t() | nil,
  error: any(),
  group: Arke.Core.Unit.t() | nil,
  old_unit: Arke.Core.Unit.t() | nil,
  op: op(),
  project: atom(),
  unit: Arke.Core.Unit.t() | nil
}