PhoenixSpec.SchemaResolver (PhoenixSpec v0.1.1)

View Source

Introspects Ecto schemas to extract field names, types, and associations.

Summary

Functions

Returns association metadata for the given schema and field.

Returns all association fields for the given schema.

Checks if the module is an Ecto schema.

Returns a map of field names to their Ecto types for the given schema module.

Returns the primary key fields for the given schema.

Functions

association(schema, field)

@spec association(module(), atom()) :: map() | nil

Returns association metadata for the given schema and field.

associations(schema)

@spec associations(module()) :: [atom()]

Returns all association fields for the given schema.

ecto_schema?(module)

@spec ecto_schema?(module()) :: boolean()

Checks if the module is an Ecto schema.

fields(schema)

@spec fields(module()) :: %{required(atom()) => atom() | tuple()}

Returns a map of field names to their Ecto types for the given schema module.

primary_key(schema)

@spec primary_key(module()) :: [atom()]

Returns the primary key fields for the given schema.