Packages

Lets you compose ecto queries in a functional way.

Current section

Files

Jump to
ecto_query_plus lib ecto_query_plus base_query.ex
Raw

lib/ecto_query_plus/base_query.ex

defmodule EctoQueryPlus.BaseQuery do
import Ecto.Query
defmacro ecto_where(query, binding, expr) do
quote do
where(unquote(query), unquote(binding), unquote(expr))
end
end
defmacro ecto_offset(query, binding) do
quote do
offset(unquote(query), unquote(binding))
end
end
defmacro ecto_limit(query, binding) do
quote do
limit(unquote(query), unquote(binding))
end
end
defmacro ecto_select(query, binding) do
quote do
select(unquote(query), unquote(binding))
end
end
defmacro ecto_select(query, binding, expr) do
quote do
select(unquote(query), unquote(binding), unquote(expr))
end
end
defmacro ecto_order_by(query, binding) do
quote do
order_by(unquote(query), unquote(binding))
end
end
defmacro ecto_preload(query, binding) do
quote do
preload(unquote(query), unquote(binding))
end
end
end