What is an easy and quick way to encode some Ecto struct from a query in IEx? I'm not looking for how to implement @derive in my application code, just a quick way to dump to JSON quickly pull some data.
@derive
I found the following worked for me. One needs to drop :__meta__ and any not loaded associations.
:__meta__
Repo.all(Event) |> Enum.map(&(Map.from_struct(&1) |> Map.drop([:__meta__]))) |> Jason.encode!()
1.4m articles
1.4m replys
5 comments
57.0k users