Ash.Dsl.Transformer behaviour (ash v1.41.1) View Source

A transformer manipulates and/or validates the entire DSL state of a resource.

It's transform/2 takes a map, which is just the values/configurations at each point of the DSL. Don't manipulate it directly, if possible, instead use functions like get_entities/3 and replace_entity/5 to manipulate it.

Use the after?/1 and before?/1 callbacks to ensure that your transformer runs either before or after some other transformer.

The pattern for requesting information from other modules that use the DSL and are also currently compiling has not yet been determined. If you have that requirement you will need extra utilities to ensure that some other DSL based module has either completed or reached a certain point in its transformers. These utilities have not yet been written.

Link to this section Summary

Link to this section Functions

Link to this function

add_entity(dsl_state, path, entity)

View Source
Link to this function

build_entity(extension, path, name, opts)

View Source
Link to this function

get_entities(dsl_state, path)

View Source
Link to this function

get_option(dsl_state, path, option)

View Source
Link to this function

get_persisted(dsl, key, default \\ nil)

View Source
Link to this function

persist(dsl, key, value)

View Source
Link to this function

replace_entity(dsl_state, path, replacement, matcher)

View Source

Link to this section Callbacks

Specs

after?(module()) :: boolean()

Specs

before?(module()) :: boolean()

Specs

transform(module(), map()) :: {:ok, map()} | {:error, term()} | :halt