~ihabunek/triglav

ref: 1a8ba58407fc58b933347c9bec5bcb4358191cbb triglav/lib/triglav/repo.ex -rw-r--r-- 288 bytes
1a8ba584Ivan Habunek Use derived data for route detail view 7 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
defmodule Triglav.Repo do
  use Ecto.Repo,
    otp_app: :triglav,
    adapter: Ecto.Adapters.Postgres

  def select!(sql, params \\ []) do
    {:ok, result} = query(sql, params)

    Enum.map(result.rows, fn row ->
      Enum.zip(result.columns, row) |> Enum.into(%{})
    end)
  end
end