SelectoMix (selecto_mix v0.3.12)

Mix tasks and tooling for automatic Selecto configuration generation.

SelectoMix provides utilities to automatically generate Selecto domain configurations from Ecto schemas, preserving user customizations across regenerations and supporting incremental updates when schemas change.

Key Features

  • Automatic Schema Discovery: Finds and introspects all Ecto schemas in your project
  • Intelligent Configuration Generation: Creates comprehensive Selecto domains with suggested defaults
  • Customization Preservation: Maintains user modifications when regenerating files
  • Incremental Updates: Detects schema changes and updates only what's necessary
  • Igniter Integration: Uses modern Elixir project modification tools

Main Mix Tasks

  • mix selecto.gen.domain - Generate Selecto domain configurations from Ecto schemas
  • mix selecto.install - Install Selecto dependencies and setup project structure
  • mix selecto.update - Update existing domain configurations after schema changes

Getting Started

  1. Add SelectoMix to your project dependencies
  2. Run mix selecto.install to setup basic structure
  3. Generate domains with mix selecto.gen.domain --all
  4. Customize the generated domains as needed
  5. Re-run generation after schema changes - customizations will be preserved

Configuration

You can configure SelectoMix in your config/config.exs:

config :selecto_mix,
  output_dir: "lib/my_app/selecto_domains",
  default_associations: true,
  preserve_customizations: true

Example Usage

# Generate domain for a single schema
mix selecto.gen.domain Blog.Post

# Generate for all schemas in a context
mix selecto.gen.domain Blog.*

# Generate for all schemas with associations
mix selecto.gen.domain --all --include-associations

# Force regeneration (overwrites customizations)
mix selecto.gen.domain Blog.Post --force

Summary

Functions

Get configuration for SelectoMix.

Get the default output directory for generated domains.

Check if Selecto dependencies are available.

List all available Ecto schemas in the current project.

Validate a schema module exists and is an Ecto schema.

Get the version of SelectoMix.

Functions

config()

Get configuration for SelectoMix.

default_output_dir()

Get the default output directory for generated domains.

dependencies_available?()

Check if Selecto dependencies are available.

discover_schemas()

List all available Ecto schemas in the current project.

validate_schema_module(module_name)

Validate a schema module exists and is an Ecto schema.

version()

Get the version of SelectoMix.