Alembic v2.1.0 Alembic.ToEctoSchema behaviour

The Alembic.ToEctoSchema behaviour converts a struct in the Alembic namespace to an Ecto.Schema.t struct.

Summary

Types

  • nil if an empty singleton
  • struct - if a non-empty singleton
  • [] - if an empty collection
  • [struct] - if a non-empty collection

A module that defines __struct__/0 and __schema__(:fields) as happens when use Ecto.Schema is run in a module

Maps JSON API Alembic.Resource.type to ecto_schema_module for casting that Alembic.Resource.type

Types

ecto_schema :: nil | struct | [] | [struct, ...]
  • nil if an empty singleton
  • struct - if a non-empty singleton
  • [] - if an empty collection
  • [struct] - if a non-empty collection
ecto_schema_module :: atom

A module that defines __struct__/0 and __schema__(:fields) as happens when use Ecto.Schema is run in a module.

ecto_schema_module_by_type :: %{Alembic.Resource.type => ecto_schema_module}

Maps JSON API Alembic.Resource.type to ecto_schema_module for casting that Alembic.Resource.type.

Functions

put_named_association(acc, params, ecto_schema_module, association_name)
to_ecto_schema(params, ecto_schema_module)

Specs

to_ecto_schema(Alembic.ToParams.params, ecto_schema_module) :: struct
to_ecto_schema(map, params, ecto_schema_module_by_type)

Specs

Callbacks

to_ecto_schema(struct, arg1, ecto_schema_module_by_type)

Parameters

  • struct - an Alembic.Document.t hierarchy struct
  • attributes_by_id_by_type - Maps a resource identifier’s Alembic.ResourceIdentifier.type and Alembic.ResourceIdentifier.id to its Alembic.Resource.attributes from Alembic.Document.t included.
  • ecto_schema_module_by_type -

Returns

  • nil if an empty singleton
  • struct - if a non-empty singleton
  • [] - if an empty collection
  • [struct] - if a non-empty collection