View Source AshPyro.Extensions.Resource.Transformers (AshPyro v0.2.1)

Tooling for Ash resource transformation.

Summary

Functions

Extract a default humanized label from an entity name.

Get a filtered list of actions from the resource DSL.

Get a specific action from the resource DSL.

Safely get nested values from maps or keyword lists that may be nil or an otherwise non-map value at any point. Great for accessing nested assigns in a template.

Collect all accumulated errors and log raise them all at once.

Inherit a value from another enitity by name.

Get the type of a resources field. Used to determine how to render it in the UI.

Functions

Extract a default humanized label from an entity name.

Link to this function

filter_actions(dsl, filter)

View Source

Get a filtered list of actions from the resource DSL.

Get a specific action from the resource DSL.

Link to this function

get_nested(value, keys, default \\ nil)

View Source

Safely get nested values from maps or keyword lists that may be nil or an otherwise non-map value at any point. Great for accessing nested assigns in a template.

Examples

iex> get_nested(nil, [:one, :two, :three])
nil

iex> get_nested(%{one: nil}, [:one, :two, :three])
nil

iex> get_nested(%{one: %{two: %{three: 3}}}, [:one, :two, :three])
3

iex> get_nested(%{one: %{two: [three: 3]}}, [:one, :two, :three])
3

iex> get_nested([one: :nope], [:one, :two, :three])
nil

iex> get_nested([one: :nope], [:one, :two, :three], :default)
:default
Link to this function

handle_errors(errors, label, dsl \\ nil)

View Source

Collect all accumulated errors and log raise them all at once.

Link to this function

inherit_pyro_config(dsl, kind, entity_name, key, default \\ nil)

View Source

Inherit a value from another enitity by name.

Link to this function

resource_field_type(dsl, field_name)

View Source

Get the type of a resources field. Used to determine how to render it in the UI.