Ash.Dsl.Transformer behaviour (ash v1.48.0-rc.12) 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.
Return true
in after_compile/0
to have the transformer run in an after_compile
hook,
but keep in mind that no modifications to the dsl structure will be retained, so there is no
point in returning a new dsl structure from transform/2
if after_compile/0
is defined. Instead,
simply return :ok
or {:error, error}