All Projects → pawurb → ecto_extras

pawurb / ecto_extras

Licence: MIT license
Ecto helper functions.

Programming Languages

elixir
2628 projects

Ecto Extras Hex.pm Hex.pm CI

Simple helper functions for Ecto.Repo and Ecto.Query that I find missing from the default implementation.

Ecto.Repo helpers (API docs)

first first! last last! count min max avg sum

Setup:

defmodule YourApp.Repo do
  use EctoExtras.Repo
  # ...
end

Example usage:

Repo.count(User)

# instead of

Repo.one(from u in User, select: count(u.id))

Ecto.Query helpers (API docs)

lower upper

Example usage:

import EctoExtras.Query

Repo.one(from u in User, where: lower(u.email) == "[email protected]")

# instead of

Repo.one(from u in User, where: fragment("lower(?)", u.email) == "[email protected]")
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].