Ecto.Query.API.all
You're seeing just the function
all
, go back to Ecto.Query.API module for more information.
Evaluates whether all values returned from the provided subquery match in a comparison operation.
from p in Post, where: p.visits >= all(
from(p in Post, select: avg(p.visits), group_by: [p.category_id])
)
For a post to match in the above example it must be visited at least as much as the average post in all categories.
from p in Post, where: p.visits == all(
from(p in Post, select: max(p.visits))
)
The above example matches all the posts which are tied for being the most visited.
Both any
and all
must be given a subquery as an argument, and they must be used on the right hand side of a comparison.
Both can be used with every comparison operator: ==
, !=
, >
, >=
, <
, <=
.