remove the select to just have the user schema returned and then:
Repo.all |> Map.new(&{&1.id, &1})
On Wednesday, August 31, 2022 at 5:20:28 PM UTC+1 Andrey Yugai wrote:
> I wouldn't claim this is a good idea because `into` in your example looks
> like leakage of app logic into DB level. If
I wouldn't claim this is a good idea because `into` in your example looks like
leakage of app logic into DB level. If you're only ought to create user id -
user map, it is pretty easy to do in Elixir from just a list of users. If you
concerned about memory/time, you could try streaming from
Hello everyone,
This is my first time posting, please excuse me if I did something wrong :)
I am writing a query like below,
query =
from u in User,
where: u.id in ^user_ids,
select: {u.id, u}
data =
query
|> Repo.all()
*|> Enum.into(%{})*
As follows, Does it make