Ecto query and Elixir case sentence

I found the solution for the first. Use variable as key in Ecto's select_merge