SelectoMix.Introspector.Ecto (selecto_mix v0.4.2)

Introspects Ecto schemas using schema/1 callbacks.

This module extracts all metadata from Ecto schemas to build standardized schema information compatible with the SelectoMix.Introspector protocol.

Summary

Functions

Extract association information for join configuration.

Map Ecto field types to Selecto/Elixir types.

Get the primary key field(s) for an Ecto schema.

Get all fields defined in an Ecto schema.

Get the database table name for an Ecto schema.

Introspect an Ecto schema module and return standardized metadata.

Functions

get_associations(schema_module, opts \\ [])

Extract association information for join configuration.

Returns a map of association name to association metadata.

get_field_types(schema_module)

Map Ecto field types to Selecto/Elixir types.

Returns a map of field name to type atom.

get_primary_key(schema_module)

Get the primary key field(s) for an Ecto schema.

Returns single atom for single primary key, list for composite keys, or nil if no primary key is defined.

get_schema_fields(schema_module)

Get all fields defined in an Ecto schema.

get_table_name(schema_module)

Get the database table name for an Ecto schema.

introspect(schema_module, opts \\ [])

Introspect an Ecto schema module and return standardized metadata.

Parameters

  • schema_module - Ecto schema module (e.g., MyApp.User)
  • opts - Options (currently unused, reserved for future use)

Returns

  • {:ok, metadata} - Standardized metadata map
  • {:error, reason} - Error if schema cannot be introspected