Skip to content

KeysetSeek Class ​

Definition ​

Builds lexicographic keyset (seek) predicates and related ORDER BY helpers.

  • Namespace: JASE.Database
  • Assembly: JASE.Database.dll

Methods ​

NameDescription
IPredicateNode Compile(IReadOnlyList<OrderBy> queryOrder, KeysetCursor cursor)Builds the lexicographic seek predicate for the given query ORDER BY and cursor values.
IReadOnlyList<OrderBy> EnsureTotalOrder(TableInfo table, IReadOnlyList<OrderBy> orderBy)Returns orderBy with a PK ascending tie-break when missing, and stamps NULLS LAST.
KeysetCapability Evaluate(TableInfo table, IReadOnlyList<OrderBy> orderBy, bool distinct = null, bool hasOrderAffectingSqlContributors = null)Conservatively evaluates whether the query shape can use keyset paging.
IReadOnlyList<OrderBy> InvertOrder(IReadOnlyList<OrderBy> orderBy)Returns a new ORDER BY list with each direction flipped (ASC↔DESC) and NULL placement flipped (LAST↔FIRST).
void ValidateCursor(KeysetCursor cursor, IReadOnlyList<OrderBy> displayOrder)Ensures cursor columns and directions match displayOrder.
IReadOnlyList<OrderBy> WithNullsLast(IReadOnlyList<OrderBy> orderBy)Copies ORDER BY entries with NullsLast set (keyset display order).

Remarks ​

Compile is always forward relative to the supplied ORDER BY: ascending tips use &gt;, descending tips use &lt;, with NULLS LAST branches. For previous-page / reverse-seek queries, invert the ORDER BY first (see InvertOrder), compile against the inverted order, then reverse rows for display.

Correctness requires a total order (typically primary-key tie-break) and NULLS LAST ordering. See docs/keyset-pagination.md.