limitToLast method
- int limit
Limits the query to the last limit documents.
Parameters:
limit: The number of documents to return from the end.
Returns: A new Query with the limit to last applied.
Example:
query = query.limitToLast(5);
Implementation
Query<T> limitToLast(int limit) {
Query<T> newQuery = Query<T>(
helper: QueryHelper(),
oracledb: _oracledb,
path: path,
);
_helper.dupQuery(newQuery, this);
for (var i = 0; i < this._explicitOrder.length; i++) {
if (this._explicitOrder[i]["direction"] == 'asc') {
newQuery._explicitOrder[i]["direction"] = 'desc';
} else {
newQuery._explicitOrder[i]["direction"] = 'asc';
}
}
newQuery._limit = limit;
return newQuery;
}