View Source Ash (ash v2.15.17)

General purpose tools for working with Ash.

Currently only contains setters/getters for process context.

Summary

Functions

Converts a context map to opts to be passed into an action.

Gets the current actor from the process dictionary

Gets the current authorize? from the process dictionary

Gets the current context from the process dictionary

Gets all of the ash context so it can be set into a new process.

Gets the current tenant from the process dictionary

Gets the current tracer

Deep merges context into the process dictionary that is used for all changesets and queries.

Removes a tracer from the process dictionary.

Sets actor into the process dictionary that is used for all changesets and queries.

Sets authorize? into the process dictionary that is used for all changesets and queries.

Sets context into the process dictionary that is used for all changesets and queries.

Sets tenant into the process dictionary that is used for all changesets and queries.

Sets the tracer into the process dictionary that will be used to trace requests

Updates the context into the process dictionary that is used for all changesets and queries.

Functions

Link to this function

context_to_opts(map, add_to \\ [])

View Source

Converts a context map to opts to be passed into an action.

@spec get_actor() :: term()

Gets the current actor from the process dictionary

@spec get_authorize?() :: term()

Gets the current authorize? from the process dictionary

@spec get_context() :: term()

Gets the current context from the process dictionary

Link to this function

get_context_for_transfer(opts \\ [])

View Source
@spec get_context_for_transfer(opts :: Keyword.t()) :: term()

Gets all of the ash context so it can be set into a new process.

Use transfer_context/1 in the new process to set the context.

@spec get_tenant() :: term()

Gets the current tenant from the process dictionary

@spec get_tracer() :: term()

Gets the current tracer

@spec merge_context(map()) :: :ok

Deep merges context into the process dictionary that is used for all changesets and queries.

@spec remove_tracer(module() | [module()]) :: :ok

Removes a tracer from the process dictionary.

@spec set_actor(map()) :: :ok

Sets actor into the process dictionary that is used for all changesets and queries.

@spec set_authorize?(map()) :: :ok

Sets authorize? into the process dictionary that is used for all changesets and queries.

@spec set_context(map()) :: :ok

Sets context into the process dictionary that is used for all changesets and queries.

In Ash 3.0, this will be updated to deep merge

@spec set_tenant(String.t()) :: :ok

Sets tenant into the process dictionary that is used for all changesets and queries.

@spec set_tracer(module() | [module()]) :: :ok

Sets the tracer into the process dictionary that will be used to trace requests

Link to this function

transfer_context(map, opts \\ [])

View Source
@spec transfer_context(term(), opts :: Keyword.t()) :: :ok
@spec update_context((map() -> map())) :: :ok

Updates the context into the process dictionary that is used for all changesets and queries.