queryDocIds method

  1. @override
Future<List<QueryRow>> queryDocIds(
  1. String table,
  2. QuerySpec spec
)
override

Returns the ids of the live documents in table that satisfy spec, in the spec's total order — (order-by value, document id) — windowed by its limit and cursor.

A document is live when its existence register (the separator-free key) is live. Predicates evaluate against the resolved value of a field row (a counter's total, a set's membership), so a typed state stored at rest matches the same way on every engine. The comparison order across value kinds is fixed: missing/null, then numbers, then text (non-scalar values compare as their JSON encoding) — every engine must produce the same order, so keyset pages line up across engines and devices.

Implementation

@override
Future<List<QueryRow>> queryDocIds(String table, QuerySpec spec) async {
  if (_db == null) return const [];
  final (sql, params) = _compileQuery(table, spec);
  final rows = _open.select(sql, params);
  return [
    for (final r in rows)
      QueryRow(docId: r['did'] as String, orderValue: r['ord']),
  ];
}