public interface Orders
Collection of methods used to specify Orders for PipelineStage.sortBy(Function) stage.

Get an instance with QueryApi.orders(), that is api.queryApi().orders(). Each method builds one order. The sortBy function returns a list of these orders, and the rows are sorted by the first order in the list, then by the next one.

Example:


 def qapi = api.queryApi()
 def p = qapi.tables().products()
 return qapi.source(p, [p.sku(), p.label()])
     .sortBy { cols -> [qapi.orders().ascNullsLast(cols.label), qapi.orders().descNullsLast(cols.sku)] }
     .stream { it.toList() }
 
Since:
14.0 - Caribou Lou
  • Method Details

    • ascNullsFirst

      Orders.Order ascNullsFirst(Expression e)
      Builds an ascending order with null values evaluated as the lowest value.
      Parameters:
      e - the expression on which the order is defined
      Returns:
      the built order
      Since:
      14.0 - Caribou Lou
      See Also:
    • ascNullsLast

      Orders.Order ascNullsLast(Expression e)
      Builds an ascending order with null values evaluated as the highest value.
      Parameters:
      e - the expression on which the order is defined
      Returns:
      the built order
      Since:
      14.0 - Caribou Lou
      See Also:
    • descNullsFirst

      Orders.Order descNullsFirst(Expression e)
      Builds a descending order with null values first.
      Parameters:
      e - the expression on which the order is defined
      Returns:
      the built order
      Since:
      14.0 - Caribou Lou
      See Also:
    • descNullsLast

      Orders.Order descNullsLast(Expression e)
      Builds a descending order with null values last.
      Parameters:
      e - the expression on which the order is defined
      Returns:
      the built order
      Since:
      14.0 - Caribou Lou
      See Also: