EctoHooks.Delta (ecto_hooks v1.0.2) View Source

Defines the struct which is given as the 2nd argument to any after_* hooks.

Contains metadata which may be useful for introspecting or otherwise conditionally running hooks only when certain conditions are met.

The following information is present in an EctoHooks.Delta:

  • The Ecto.Repo callback that triggered the hook
  • The name of the current hook (useful if delegating to private functions in your schema)
  • The Ecto.Queryable passed into the triggering Ecto.Repo callback if any
  • The Ecto.Changeset passed into the triggering Ecto.Repo callback if any

Link to this section Summary

Link to this section Types

Specs

hook() ::
  :after_update
  | :after_insert
  | :after_get
  | :after_delete
  | :before_update
  | :before_insert
  | :before_delete

Specs

repo_callback() ::
  :update!
  | :update
  | :one!
  | :one
  | :insert_or_update!
  | :insert_or_update
  | :insert!
  | :insert
  | :get_by!
  | :get_by
  | :get!
  | :get
  | :delete!
  | :delete
  | :all

Specs

t() :: %EctoHooks.Delta{
  changeset: term(),
  hook: term(),
  queryable: term(),
  record: term(),
  repo_callback: term(),
  source: term()
}

Link to this section Functions

Link to this function

new!(repo_callback, hook, source)

View Source

Specs

new!(repo_callback(), hook(), source :: any()) :: t() | no_return()