Skip to content

Support where queries with limits

Requirement

Add support for making a where query where the number of returned items is limited. In SQL this is equivalent to a LIMIT parameter to the query.

Value Proposition

Implementing this would make it possible to define queries such as: find 10 persons where age > 10 or find 10 persons where age > 10 ordered by last name (after #21)

Design Ideas

At this point it may be necessary to create a new Query object that acts as a kind of builder. Create a new Query then call methods on it to define that query, before finally executing it. For example:

val query = newQuery()
query.where("name", "John")
query.limit(10)

val results: Iterable = query.find()
val deleted: Int = query.delete()