AshCommanded.Commanded.Transformers.GenerateCommandModules (AshCommanded v0.1.0)
View SourceGenerates command modules based on the commands defined in the DSL.
For each command defined in a resource, this transformer will generate a corresponding module with the command name as a struct with the specified fields.
This transformer should run before any other code generation transformers.
Example
Given a resource with the following command:
command :register_user do
fields [:id, :email, :name]
identity_field :id
end
This transformer will generate a module like:
defmodule MyApp.Commands.RegisterUser do
@moduledoc "Command for registering a user"
@type t :: %__MODULE__{
id: String.t(),
email: String.t(),
name: String.t()
}
defstruct [:id, :email, :name]
end
Summary
Functions
Callback implementation for Spark.Dsl.Transformer.after?/1
.
Callback implementation for Spark.Dsl.Transformer.after_compile?/0
.
Specifies that this transformer should run before the event module transformer.
Transforms the DSL state to generate command modules.
Functions
Callback implementation for Spark.Dsl.Transformer.after?/1
.
Callback implementation for Spark.Dsl.Transformer.after_compile?/0
.
Specifies that this transformer should run before the event module transformer.
Transforms the DSL state to generate command modules.
Examples
iex> transform(dsl_state)
updated_dsl_state