Polymorphic embeds

28 views
Skip to first unread message

Thiago Majesk Goulart

unread,
Jun 24, 2025, 4:10:01 PMJun 24
to elixir-ecto
Hi! This is something that I see myself needing time and time again while working with dynamic data (mostly JSON) and every time it makes me wish this was part of core library. I know we already have some packages that solve this issue, but I haven't seen a solution that leverages parameterized types yet. 

To be honest , I'm finding this solution quite elegant given that it has a similar ergonomics to Ecto.Enum, so I thought I would check if the maintainers are open to a PR to include something like it in the library (or if I should just publish this to hex). The name is inspired by C# dynamic type. Here's the gist showing a version of the implementation I've being using for a couple months now: https://gist.github.com/thiagomajesk/559cad1cdad2bb508ca73c55b45648eb.

Reply all
Reply to author
Forward
0 new messages