ash v0.1.8 Ash.Api.Interface behaviour View Source

The primary entry point for interacting with resources and their data.

Link to this section Summary

Callbacks

  • :upsert? - If a conflict is found based on the primary key, the record is updated in the database (requires upsert support) The default value is false.

  • :upsert? - If a conflict is found based on the primary key, the record is updated in the database (requires upsert support) The default value is false.

  • :verbose? - Log engine operations (very verbose?) The default value is false.
  • :verbose? - Log engine operations (very verbose?) The default value is false.
  • :verbose? - Log engine operations (very verbose?) The default value is false.
  • :verbose? - Log engine operations (very verbose?) The default value is false.
  • :verbose? - Log engine operations (very verbose?) The default value is false.
  • :verbose? - Log engine operations (very verbose?) The default value is false.

Refetches a record from the database

Refetches a record from the database

Refetches a record from the database, raising on error.

  • :verbose? - Log engine operations (very verbose?) The default value is false.
  • :verbose? - Log engine operations (very verbose?) The default value is false.
  • :attributes - Changes to be applied to attribute values The default value is %{}.

  • :attributes - Changes to be applied to attribute values The default value is %{}.

Link to this section Callbacks

Link to this callback

create(resource, params)

View Source
create(resource :: Ash.resource(), params :: Ash.create_params()) ::
  {:ok, Ash.record()} | {:error, Ash.error()}
  • :upsert? - If a conflict is found based on the primary key, the record is updated in the database (requires upsert support) The default value is false.

  • :attributes - Changes to be applied to attribute values The default value is %{}.

  • :relationships - Changes to be applied to relationship values The default value is %{}.

  • :verbose? - Log engine operations (very verbose?) The default value is false.

Link to this callback

create!(resource, params)

View Source
create!(resource :: Ash.resource(), params :: Ash.create_params()) ::
  Ash.record() | no_return()
  • :upsert? - If a conflict is found based on the primary key, the record is updated in the database (requires upsert support) The default value is false.

  • :attributes - Changes to be applied to attribute values The default value is %{}.

  • :relationships - Changes to be applied to relationship values The default value is %{}.

  • :verbose? - Log engine operations (very verbose?) The default value is false.

Link to this callback

destroy(record, params)

View Source
destroy(record :: Ash.record(), params :: Ash.update_params()) ::
  :ok | {:error, Ash.error()}
  • :verbose? - Log engine operations (very verbose?) The default value is false.
Link to this callback

destroy!(record, params)

View Source
destroy!(record :: Ash.record(), params :: Ash.update_params()) ::
  :ok | no_return()
  • :verbose? - Log engine operations (very verbose?) The default value is false.
Link to this callback

get(resource, id_or_filter, params)

View Source
get(resource :: Ash.resource(), id_or_filter :: term(), params :: Ash.params()) ::
  {:ok, Ash.record()} | {:error, Ash.error()}
  • :verbose? - Log engine operations (very verbose?) The default value is false.
Link to this callback

get!(resource, id_or_filter, params)

View Source
get!(resource :: Ash.resource(), id_or_filter :: term(), params :: Ash.params()) ::
  Ash.record() | no_return()
  • :verbose? - Log engine operations (very verbose?) The default value is false.
Link to this callback

read(resource, params)

View Source
read(resource :: Ash.resource(), params :: Ash.params()) ::
  {:ok, [Ash.resource()]} | {:error, Ash.error()}
  • :verbose? - Log engine operations (very verbose?) The default value is false.
Link to this callback

read!(resource, params)

View Source
read!(resource :: Ash.resource(), params :: Ash.params()) ::
  [Ash.resource()] | no_return()
  • :verbose? - Log engine operations (very verbose?) The default value is false.
Link to this callback

reload(record)

View Source
reload(record :: Ash.record()) :: {:ok, Ash.record()} | {:error, Ash.error()}

Refetches a record from the database

Link to this callback

reload(record, params)

View Source
reload(record :: Ash.record(), params :: Ash.params()) ::
  {:ok, Ash.record()} | {:error, Ash.error()}

Refetches a record from the database

Link to this callback

reload!(record, params)

View Source
reload!(record :: Ash.record(), params :: Ash.params()) ::
  Ash.record() | no_return()

Refetches a record from the database, raising on error.

See reload/1.

Link to this callback

side_load(resource, params)

View Source
side_load(resource :: Ash.resource(), params :: Ash.params()) ::
  {:ok, [Ash.resource()]} | {:error, Ash.error()}
  • :verbose? - Log engine operations (very verbose?) The default value is false.
Link to this callback

side_load!(resource, params)

View Source
side_load!(resource :: Ash.resource(), params :: Ash.params()) ::
  [Ash.resource()] | no_return()
  • :verbose? - Log engine operations (very verbose?) The default value is false.
Link to this callback

update(record, params)

View Source
update(record :: Ash.record(), params :: Ash.update_params()) ::
  {:ok, Ash.record()} | {:error, Ash.error()}
  • :attributes - Changes to be applied to attribute values The default value is %{}.

  • :relationships - Changes to be applied to relationship values The default value is %{}.

  • :verbose? - Log engine operations (very verbose?) The default value is false.

Link to this callback

update!(record, params)

View Source
update!(record :: Ash.record(), params :: Ash.update_params()) ::
  Ash.record() | no_return()
  • :attributes - Changes to be applied to attribute values The default value is %{}.

  • :relationships - Changes to be applied to relationship values The default value is %{}.

  • :verbose? - Log engine operations (very verbose?) The default value is false.