SelectoMix (selecto_mix v0.4.2)

Mix tasks and tooling for automatic Selecto configuration generation.

SelectoMix provides utilities to automatically generate Selecto domain configurations from Ecto schemas, preserve user customizations across regenerations, and scaffold related SelectoComponents persistence helpers.

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
  • Igniter Integration: Uses modern Elixir project modification tools
  • Persistence Scaffolds: Generates saved views, saved view configs, exported views, and filter set persistence modules

Main Mix Tasks

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 mix selecto.gen.domain 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.