Hi, thanks for your reply. I am sorry that I just copy the content form my issue in Elixir project and forgot to say hi to community.
I enjoy(love) Elixir and used it in my job for two years, thanks for Jose and Joe 's creating. Hope that I can contribute to Elixir! 😀 On Mon, Apr 22, 2019 at 4:38 PM José Valim <jose.va...@plataformatec.com.br> wrote: > Thanks 胡永浩! > > I write similar code frequently too, it would be nice if everyone could > share how they are writing said/similar constructs. If it it happens too > frequently, I create a small function to do it: > https://github.com/elixir-ecto/ecto_sql/blob/master/lib/ecto/adapters/postgres.ex#L146-L147 > > > *José Valim* > www.plataformatec.com.br > Skype: jv.ptec > Founder and Director of R&D > > > On Mon, Apr 22, 2019 at 10:26 AM 胡永浩 <christopher...@gmail.com> wrote: > >> I am now doing it like this in a route: >> >> query = %{ type: params["type"] } >> query = if !!params["language"], do: Map.put(query, :language, >> params["language"]), else: query >> query = if !!params["id"], do: Map.put(query, :language, params["id"]), >> else: query >> >> I wonder, could we afford a function to decide whether to put the key?(I >> do mention this as a proposal if there is no best practice.) >> >> >> RIP, Joe. >> >> >> >> -- >> 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/11ef9a1a-1bbd-4ce3-93ff-3ad16466cb0e%40googlegroups.com >> <https://groups.google.com/d/msgid/elixir-lang-core/11ef9a1a-1bbd-4ce3-93ff-3ad16466cb0e%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- > 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/CAGnRm4Lgi29wSQ0SXEoADsnEO%2BzSdojY9X9ZjJY7SMsRd9AjHA%40mail.gmail.com > <https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4Lgi29wSQ0SXEoADsnEO%2BzSdojY9X9ZjJY7SMsRd9AjHA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- -- Regards, YongHao Hu -- 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/CAASkFKVOQWXrzJE8N5VJOiJjChFhwTY9T_JXB5aQ5aJfBbaiLw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.