Hi all,
I have to implement a functionality that sends schema data to another application instance and I'm not interested in serialize __struct__ and __meta__ fields existing in my schemas. To do so I have implemented a recursive function that removes them, but I think would be nice to have an option to either remove them from the Ecto.Schema API and from the Ecto Queries select (something similar to map() but without explicit which fields will compose the resulting map).
To remove from Ecto.Schema api we would have to call MySchema.to_map.
To remove from a query result we would have something like: from x in MySchema, select: map(x).
Using repo we could have: Repo.all(MySchema) |> Repo.to_map
There's a problem for not loaded associations, since would not be possible to get all the data in this scenario. In this scenario the map function would return that it couldn't perform the operation.
I'm not sure this is something sufficiently general or important to be part of Ecto, but I'm interested in knowing what you guys think.
Thanks,
Aeliton