~ihabunek/triglav

ref: d1b5915f3e023d04850eabf702bda7207a337302 triglav/lib/triglav/repo.ex -rw-r--r-- 288 bytes
d1b5915fIvan Habunek Validate platform distance from route 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