Brings up a typed characteristic value from an assignment-source instance.
Mirrors the shape of Diffo.Provider.Calculations.InheritedPlace and
Diffo.Provider.Calculations.InheritedParty — traverses
AssignmentRelationship by alias to reach source instances, then queries
the typed characteristic resource on each source and returns its .value.
Local-to-this-repo for now. Worth yarning upstream as a diffo-side
inherited_characteristic DSL declaration backed by a
Diffo.Provider.Calculations.InheritedCharacteristic calc, sitting
alongside the existing inherited-place and inherited-party machinery.
Options
via:(required) — list of alias atoms naming the assignment chain from this instance back to the source whose characteristic we want. Each step filtersAssignmentRelationshipbytarget_idandalias, then followssource_idto the next set of instances. The aliases are the assignee's slot names, supplied when the assignment is made.characteristic_module:(required) — the typed characteristic Ash resource on the final source (e.g.ShelfCharacteristic). The calc queries this resource byinstance_idand returns the.value.
Example
# Card brings up its shelf's typed characteristic via the slot
# assignment the shelf made to it (alias :slot on the incoming
# AssignmentRelationship).
calculate :shelf, :map,
{DiffoExample.Calculations.InheritedCharacteristic,
[via: [:slot], characteristic_module: ShelfCharacteristic]}
# Path brings up the same via a two-hop chain — port-then-slot.
calculate :shelf, :map,
{DiffoExample.Calculations.InheritedCharacteristic,
[via: [:port, :slot], characteristic_module: ShelfCharacteristic]}
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.