- build tool
- interface for player
- separate policy for each type of change
- filter / cast incoming data
- validate data (length or format)
- composable
- Phoenix defines protocol
Phoenix.Param
, which extractsid
of struct if exists - Elixir protocols can be implemented for any data structure anywhere
- "overwriting" the
to_param
function to customize it for path helper
- custom type, allows you to associate some behavior to
id
fields - custom type defined according to Ecto.Type behavior
- expects you to define four functions:
- type: underlying ecto type
- cast: called when external data passed into Ecto
- dump: invoked when data sent to db
- load: invoked when data loaded