Current section
Files
Jump to
Current section
Files
ecto_extras
README.md
README.md
# Ecto Extras [](https://hex.pm/packages/ecto_extras) [](https://github.com/pawurb/ecto_extras/blob/master/LICENSE) [](https://github.com/pawurb/ecto_extras/actions)A set of helper functions for `Ecto.Repo` and `Ecto.Query`### `Ecto.Repo` helpers`first` `first!` `last` `last!` `count` `min` `max` `avg` `sum`Setup:```elixirdefmodule YourApp.Repo do use EctoExtras.Repo # ...end```Example usage:```elixirRepo.count(User)# instead ofRepo.one(from u in User, select: count(u.id))```### `Ecto.Query` helpers`lower` `upper`Example usage:```elixirimport EctoExtras.QueryRepo.one(from u in User, where: lower(u.email) == "email@example.com")# instead ofRepo.one(from u in User, where: fragment("lower(?)", u.email) == "email@example.com")```