Packages

An Elixir Ecto Package to Boost Your Productivity and Achieve 90% throughput in Just 10% of the Time.

Current section

Files

Jump to
ecto_entity lib entity conditions.ex
Raw

lib/entity/conditions.ex

defmodule Ecto.Entity.Conditions do
import Ecto.Query
defmacro __using__(_) do
quote do
def where(field, value) when is_binary(field) do
String.downcase(field)
|> String.to_atom()
|> __MODULE__.where(value)
end
def where(field, value) do
from(u in __MODULE__, where: field(u, ^field) == ^value)
end
end
end
end