Ash.Resource.Change.Builtins (ash v1.47.12) View Source
Built in changes that are available to all resources
The functions in this module are imported by default in the actions section.
Link to this section Summary
Functions
Passes the provided value into Ash.Changeset.ensure_selected/2
Passes the provided value into changeset.api.load()
, after the action has completed.
Calls Ash.Changeset.manage_relationship/4
with the changeset and relationship provided, using the value provided for the named argument
Clears a change off of the changeset before the action runs.
Relates the actor to the data being changed, as the provided relationship.
Passes the provided value into Ash.Changeset.select/3
Sets the attribute to the value provided.
Merges the given query context. If an MFA is provided, it will be called with the changeset.
Link to this section Functions
Passes the provided value into Ash.Changeset.ensure_selected/2
Passes the provided value into changeset.api.load()
, after the action has completed.
Calls Ash.Changeset.manage_relationship/4
with the changeset and relationship provided, using the value provided for the named argument
For example
change manage_relationship(:add_comments, :comments, on_missing: :ignore, on_match: :no_match, on_no_match: {:create, :add_comment_to_post}
Clears a change off of the changeset before the action runs.
Useful if a change is only used in validations but shouldn't ultimately be written to the data layer
Relates the actor to the data being changed, as the provided relationship.
Passes the provided value into Ash.Changeset.select/3
Sets the attribute to the value provided.
If a zero argument function is provided, it is called to determine the value.
If a tuple of {:arg, :argument_name}
is provided, the value will be read from the argument if supplied.
If the argument is not supplied then nothing happens.
Specs
Merges the given query context. If an MFA is provided, it will be called with the changeset.
The MFA should return {:ok, context_to_be_merged}
or {:error, term}