Assume there is a model, Users
and Users
has the field admin
(just an example).
The query must always return all Users
where admin == false
but only when asked to do so, to also return all Users
where admin == true
, but in one single DB request.
so the return subsets might be:
where A
is admin == false
where B
is admin == true
Return A
OR A ∪ B
Something like this should work:
then you just call
User.example()
orUser.example(true)
depending on if you wantA
orA U B