Extend Ecto's query API with your own macros

Imagine for a second this is something you're using a lot when programming Elixir and Phoenix: 

```                
Repo.one(
	from u in User,
		where: fragment("lower(?)", u.email) == ^email
)

```

You can write your own Elixir macro to improve your flow. 

```
defmacro lower(arg) do
	quote do: fragment("lower(?)", unquote(arg))
end
```

Then your query can be rewritten like this: 
```
Repo.one(
	from u in User,
		where: lower(u.email) == ^email
)

```

Nick Ciolpan
07 Jul 2020
« Back to post