With Ecto, 🎶 you can always get what you want. And if you try sometimes, well, you might find, you can select want you need 🎶.
Structs and maps are easy to work with in Elixir, but if they are stored in the database as JSON and accessed via an Ecto Schema, it’s not as clear how to query them. We’re going to explore how to do that, and make it clear and easy.
You can use PostgreSQL’s JSON data types to store embedded data on Ecto models. But the way Ecto tells you to store it might not be the best way.
A look at how to preload database associations using Elixir’s Ecto library.
Store semi-structured data inside a Postgres table
without sacrificing expressiveness.