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 胡永浩 <[email protected]> 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 [email protected].
> 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4Lgi29wSQ0SXEoADsnEO%2BzSdojY9X9ZjJY7SMsRd9AjHA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to