getStrSeek method

  1. @protected
String getStrSeek(
  1. QueryDirection direction, {
  2. required bool first,
})

Implementation

@protected
String getStrSeek(QueryDirection direction, {required bool first}) {
  if (first) {
    if (order.isEmpty) ////
      return "1";
    return order
        .map((var o) => o.expression.isNotEqual(SqlL(null)))
        .reduce((var v, var e) => v & e)
        .str;
  }
  bool forward = direction == QueryDirection.forward;
  bool distinctionRowId = distinction == QueryDistinction.rowid;
  SqlI id = SqlI(distinctionRowId ? columnRowId : columnKeyId);
  SqlX seek = forward ? id > SqlX(":0") : id < SqlX(":0");
  for (int i = order.length - 1; i >= 0; --i) {
    SqlX x = order[i].expression;
    SqlX p = SqlX(":${order.length - i}");
    bool ascending = order[i].sorting == QuerySorting.ascending;
    if ((ascending && forward) || (!ascending && !forward))
      seek = (x >= p) & ((x > p) | seek);
    else
      seek = (x <= p) & ((x < p) | seek);
  }
  return seek.str;
}