MCPcopy Create free account
hub / github.com/TanStack/db / rangeQueryReversed

Method rangeQueryReversed

packages/db/src/indexes/btree-index.ts:279–291  ·  view source on GitHub ↗

* Performs a reversed range query

(options: RangeQueryOptions = {})

Source from the content-addressed store, hash-verified

277 * Performs a reversed range query
278 */
279 rangeQueryReversed(options: RangeQueryOptions = {}): Set<TKey> {
280 const { from, to, fromInclusive = true, toInclusive = true } = options
281 const hasFrom = `from` in options
282 const hasTo = `to` in options
283
284 // Swap from/to for reversed query, respecting explicit undefined values
285 return this.rangeQuery({
286 from: hasTo ? to : this.orderedEntries.maxKey(),
287 to: hasFrom ? from : this.orderedEntries.minKey(),
288 fromInclusive: toInclusive,
289 toInclusive: fromInclusive,
290 })
291 }
292
293 /**
294 * Internal method for taking items from the index.

Callers

nothing calls this directly

Calls 3

rangeQueryMethod · 0.95
maxKeyMethod · 0.45
minKeyMethod · 0.45

Tested by

no test coverage detected