As %{foo: foo} is syntactic sugar for %{:foo => foo} the following should work:
[:company_id, :sales_id]
|> Enum.each(fn key ->
def first(%{unquote(key) => val}, user), do: do_first(val, user)
end)
But to be honest, how is do_first/2supposed to know what kind of id you are passing in?


















