AshCommanded.Commanded.Transformers.BaseTransformer (AshCommanded v0.1.0)
View SourceA base module for Commanded DSL transformers.
This module provides common functionality for transformers that generate code based on the Commanded DSL configuration.
Summary
Functions
Converts an atom to CamelCase string.
Creates a module with the given name and contents.
Gets the module prefix for generated modules.
Gets the resource name from the resource module.
Functions
Converts an atom to CamelCase string.
Examples
iex> camelize_atom(:register_user)
"RegisterUser"
@spec create_module(module(), Macro.t(), Macro.Env.t()) :: :ok
Creates a module with the given name and contents.
This is a wrapper around Module.create/3 that handles the environment location.
Examples
iex> create_module(MyApp.Commands.RegisterUser, quoted_ast, __ENV__)
:ok
Gets the module prefix for generated modules.
This extracts the base namespace from the resource module, which will be used as the prefix for all generated modules.
Examples
iex> get_module_prefix(MyApp.Accounts.User)
MyApp.Accounts
Gets the resource name from the resource module.
Examples
iex> get_resource_name(MyApp.Accounts.User)
"User"