Computed virtual fields

70 views
Skip to first unread message

Elias Arruda

unread,
Dec 28, 2023, 3:15:52 PM12/28/23
to elixir-ecto
It would be cool if we could compute virtual fields somehow

something like:

schema "user" do
  field :name, :string
  field :last_name, :string

  field :full_name, :string, virtual: true, compute: &full_name/1
end

defp full_name(user), do: user.name <> user.last_name

What are the implications on doing something like that?
Reply all
Reply to author
Forward
0 new messages