EctoMorph.map_from_struct
You're seeing just the function
map_from_struct
, go back to EctoMorph module for more information.
Specs
Creates a map out of the Ecto struct, removing the internal ecto fields. Optionally you can remove the inserted_at and updated_at timestamp fields also by passing in :exclude_timestamps as an option
This function is not deep. Prefer deep_filter_by_schema_fields
or filter_by_schema_fields
Examples
iex> map_from_struct(%Test{}, [:exclude_timestamps])
%Test{foo: "bar", id: 10}
iex> map_from_struct(%Test{})
%Test{foo: "bar", updated_at: ~N[2000-01-01 23:00:07], inserted_at: ~N[2000-01-01 23:00:07], id: 10}
iex> map_from_struct(%Test{}, [:exclude_timestamps, :exclude_id])
%Test{foo: "bar"}