SelectoMix.OverlayGenerator (selecto_mix v0.4.2)

Generates overlay configuration files for domain customization.

Overlay files allow users to customize domain configurations without modifying the generated domain files, enabling safe regeneration.

Summary

Functions

Generates an overlay file template for a domain.

Generates the overlay file path from the domain file path.

Generates the overlay module name from the domain module name.

Functions

generate_overlay_file(module_name, config, opts \\ [])

Generates an overlay file template for a domain.

Parameters

  • module_name - The full module name (e.g., "MyApp.SelectoDomains.ProductDomain")
  • config - The domain configuration map (used to extract column names, etc.)
  • opts - Options (currently unused, for future extensibility)

Returns

A string containing the overlay module code.

overlay_file_path(domain_file_path)

Generates the overlay file path from the domain file path.

Examples

iex> overlay_file_path("lib/my_app/selecto_domains/product_domain.ex")
"lib/my_app/selecto_domains/overlays/product_domain_overlay.ex"

overlay_module_name(domain_module_name)

Generates the overlay module name from the domain module name.

Examples

iex> overlay_module_name("MyApp.SelectoDomains.ProductDomain")
"MyApp.SelectoDomains.Overlays.ProductDomainOverlay"