Reads a field from target instances reached via DefinedSimpleRelationship.
Traverses DefinedSimpleRelationship in the forward direction — filtering by
source_id = current.id — and returns the named field from each resolved target
instance. Both type: and alias: are optional filters; when omitted they match
any value on that dimension.
Options
field:(required) — atom naming the field to read from the target instance (e.g.:name,:type).alias:(optional) — atom matching thealiasattribute on the relationship. When omitted, relationships with any alias (including nil) are included.type:(optional) — atom matching thetypeattribute on the relationship (e.g.:assignedTo,:reliesOn). When omitted, all types are included.
Providing neither filter returns fields from every forward DefinedSimpleRelationship
on this instance. In practice at least one of alias: or type: should be supplied,
since a source instance typically has many forward relationships pointing to unrelated
things.
Examples
# Name of the target reached via the :provides alias
calculate :provider_name, {:array, :string},
{Diffo.Provider.Calculations.FieldViaRelationship, [alias: :provides, field: :name]}
# Name of the target reached via the :link alias, restricted to :assignedTo type
calculate :assigned_linked_name, {:array, :string},
{Diffo.Provider.Calculations.FieldViaRelationship,
[type: :assignedTo, alias: :link, field: :name]}
Summary
Functions
Callback implementation for Ash.Resource.Calculation.describe/1.
Callback implementation for Ash.Resource.Calculation.has_expression?/0.
Callback implementation for Ash.Resource.Calculation.init/1.
Callback implementation for Ash.Resource.Calculation.strict_loads?/0.
Functions
Callback implementation for Ash.Resource.Calculation.describe/1.
Callback implementation for Ash.Resource.Calculation.has_expression?/0.
Callback implementation for Ash.Resource.Calculation.init/1.
Callback implementation for Ash.Resource.Calculation.strict_loads?/0.