I have a method which return a Query:
def list:Query[User] = from(users)(u => where(u.age>20) select(u))
Now I want to count the list, but this method:
list.count(_ => true)
will get and loop all elements in the list.
I want to find a solution to make a "select count" statement from the Query[User]
, but not found yet.
Or I have to write another method for count:
def countList: Long = from(users)(u => where(u.age>20) compute(count))
Which is not what I want.
Try to compose the two queries:
from(list)(_ => compute(count))