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!()
2.1m questions
2.1m answers
60 comments
57.0k users