[Proposal] Integer support in Ecto.Enum

30 views
Skip to first unread message

Jørgen Orehøj Erichsen

unread,
Dec 14, 2020, 1:45:21 AM12/14/20
to elixir-ecto
Hi

Currently Ecto.Enum have support for a string database values to atoms mapping like this:

field :status, Ecto.Enum, values: [:foo, :bar, :baz]

I have added support for mapping integer database values to atoms in my Ecto fork with a syntax like this:

field :status, Ecto.Enum, values: [foo: 1, bar: 2, baz: 5]

Would that be useful to others? Should I open a PR?

Kind regards,
Jørgen

José Valim

unread,
Dec 14, 2020, 2:45:31 AM12/14/20
to elixi...@googlegroups.com
Yes, please open up a PR!

--
You received this message because you are subscribed to the Google Groups "elixir-ecto" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-ecto...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-ecto/37fce7e3-fa46-40ae-8448-f2e709f6b6f7n%40googlegroups.com.

Jørgen Orehøj Erichsen

unread,
Dec 14, 2020, 11:16:49 AM12/14/20
to elixir-ecto
Reply all
Reply to author
Forward
0 new messages