{:ok, %Postgrex.Result{columns: ["code", "expires", "id", "name"], command: :select, connection_id: 30856, num_rows: 2, rows: [["Three-001", {{2011, 1, 1}, {0, 0, 0, 0}}, 3, "Mike"], ["Three-002", {{2011, 1, 1}, {0, 0, 0, 0}}, 1, "Mike"]]}}
[
{code:"Three-001", expires:"01/01/2016", id=1, name="Mike"},
{code:"Three-002", expires:"01/01/2016", id=1, name="Mike"}
]--
You received this message because you are subscribed to the Google Groups "elixir-ecto" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-ecto...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-ecto/486d7ec8-5de3-4a29-9e79-d8daca593e9f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-ecto/CAGnRm4%2BHeLjuq%3D%3DoD9wko6ZcWOXKc4zR7dOzn5Ka7PO1EpLOQA%40mail.gmail.com.
maps cannot be converted to_param. A struct was expected, got:To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-ecto/1a096693-dbd7-40a0-8c2b-b2b9ceaefdfe%40googlegroups.com.
def sql_magic(result_of_Ecto_Adapters_SQL_query) do
result = Enum.map result_of_Ecto_Adapters_SQL_query.rows, fn(row) ->
Enum.zip(result_of_Ecto_Adapters_SQL_query.columns, row) |> Map.new
end--
You received this message because you are subscribed to the Google Groups "elixir-ecto" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-ecto...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-ecto/687526fe-4738-4b21-bdfa-03f19c97c49a%40googlegroups.com.
protocol Enumerable not implemented for %Postgrex.Result{columns: ["code", "expires", "id", "name"], command: :select, connection_id: 28274
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-ecto/7e1507fd-febe-45ae-a6ff-250697883b99%40googlegroups.com.
Ecto.DateTime.cast!(date/time tuple)
def sql_magic(result_of_Ecto_Adapters_SQL_query) do
columns = result_of_Ecto_Adapters_SQL_query.columns |> Enum.map(&(String.to_atom(&1)))
Enum.map result_of_Ecto_Adapters_SQL_query.rows, fn(row) ->
map = Enum.zip(columns, row) |> Map.new
with {:ok, time} <- Ecto.DateTime.cast(map.inserted_at) do
Map.put(map, :inserted_at, to_string(time))
else
_ ->
map
end
end
end