Thank you for your answers. You are right. 31 Ağustos 2022 Çarşamba tarihinde saat 19:54:22 UTC+3 itibarıyla danie...@gmail.com şunları yazdı:
> 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 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 >> repo. If your data is inevitably key value table, then maybe you better off >> using JSONB column for storing maps, or even exploring document DBs. >> >> >> >> >> -------- Original Message -------- >> On 31 Aug 2022, 23:54, Yusuf < yusufdem...@gmail.com> wrote: >> >> >> 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 sense to add the "into" keyword into to this >> query? >> >> query = >> from u in User, >> where: u.id in ^user_ids, >> select: {u.id, u}, >> >> *into: %{}* >> data = >> query >> |> Repo.all() >> >> >> I would like your thoughts on this one. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "elixir-lang-core" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to elixir-lang-co...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/elixir-lang-core/0e57204b-302b-494e-bcce-e0d1776218a8n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/elixir-lang-core/0e57204b-302b-494e-bcce-e0d1776218a8n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/de7ca46d-83ed-40fa-87f7-fb81481c4fcbn%40googlegroups.com.