Interface PagedQuery
-
- All Implemented Interfaces:
public interface PagedQuery<R>
Used to build a Query that supports limit and offset.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interface
PagedQuery.ResultSet
A result set containing the results of calling execute.
Use this class to access the results of a query and to re-execute the query to retrieve following pages of results by using hasNext and next.
Example usage:
- Kotlin:
val resultSet = query.execute() processResultsWithApplicationLogic(resultSet.results) while (resultSet.hasNext()) { val results = resultSet.next() processResultsWithApplicationLogic(results) }
- Java:
PagedQuery.ResultSet<Integer> resultSet = query.execute(); processResultsWithApplicationLogic(resultSet.getResults()); while (resultSet.hasNext()) { List<Integer> results = resultSet.next(); processResultsWithApplicationLogic(results); }
- Kotlin:
-
Method Summary
Modifier and Type Method Description abstract PagedQuery<R>
setLimit(int limit)
Sets the maximum number of results to return. abstract PagedQuery<R>
setOffset(int offset)
Sets the index of the first result in the query to return. abstract PagedQuery.ResultSet<R>
execute()
Executes the PagedQuery. -
-
Method Detail
-
setLimit
@NotNull() abstract PagedQuery<R> setLimit(int limit)
Sets the maximum number of results to return.
If no limit is set, all records will be returned.
- Parameters:
limit
- The maximum number of results to return.- Returns:
The same PagedQuery instance.
-
setOffset
@NotNull() abstract PagedQuery<R> setOffset(int offset)
Sets the index of the first result in the query to return.
A default of `0` will be used if it is not set.
- Parameters:
offset
- The index of the first result in the query to return.- Returns:
The same PagedQuery instance.
-
execute
@Suspendable()@NotNull() abstract PagedQuery.ResultSet<R> execute()
Executes the PagedQuery.
- Returns:
A ResultSet containing the results of executing the query.
-
-
-
-