#1945 - ENH: Add query.orderById(boolean) to ExpressionList ... improve fluid style

This commit is contained in:
rob bygrave
2020-02-17 16:47:37 +13:00
parent a14288b06d
commit 6961bf5787
3 changed files with 18 additions and 0 deletions
@@ -52,6 +52,14 @@ public interface ExpressionList<T> {
*/
Query<T> query();
/**
* Controls, if paginated queries should always append an 'order by id' statement at the end to
* guarantee a deterministic sort result. This may affect performance.
* If this is not enabled, and an orderBy is set on the query, it's up to the programmer that
* this query provides a deterministic result.
*/
Query<T> orderById(boolean orderById);
/**
* Set the order by clause replacing the existing order by clause if there is
* one.
@@ -354,6 +354,11 @@ public class DefaultExpressionList<T> implements SpiExpressionList<T> {
return query.order(orderBy);
}
@Override
public Query<T> orderById(boolean orderById) {
return query.orderById(orderById);
}
@Override
public Query<T> apply(FetchPath fetchPath) {
return query.apply(fetchPath);
@@ -813,6 +813,11 @@ class JunctionExpression<T> implements SpiJunction<T>, SpiExpression, Expression
return exprList.orderBy(orderBy);
}
@Override
public Query<T> orderById(boolean orderById) {
return exprList.orderById(orderById);
}
@Override
public Query<T> query() {
return exprList.query();