ash icon indicating copy to clipboard operation
ash copied to clipboard

Global Context for Load/Calculcations

Open allenwyma opened this issue 1 year ago • 0 comments

Is your feature request related to a problem? Please describe. When loading multiple resources, it'd be great to pass in a shared context to help alleviate complexity. I.E. a context for loading calculations.

Describe the solution you'd like I'd like to be able to set the context: %{global: %{locale: "en"}}, and this will be merged with further context and available to me in calculations.

Describe alternatives you've considered Right now, the alternative is I need to specifically set the query for the join relation, but this can be cumbersome if i'm joining a lot of resources.

Express the feature either with a change to resource syntax, or with a change to the resource interface

For example

Ash.read!(Post, load: [:name, comments: [:name], context: %{global: %{locale: "en"}})

Additional context https://github.com/ash-project/ash/issues/1516

allenwyma avatar Oct 14 '24 11:10 allenwyma