Re: [elixir-core:11032] [Proposal] Add "into" keyword to ecto query expression

2022-08-31 Thread Daniel KukuĊ‚a
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

Re: [elixir-core:11030] [Proposal] Add "into" keyword to ecto query expression

2022-08-31 Thread 'Andrey Yugai' via elixir-lang-core
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

[elixir-core:11030] [Proposal] Add "into" keyword to ecto query expression

2022-08-31 Thread Yusuf
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