MCPcopy Index your code
hub / github.com/TanStack/db / forRange

Method forRange

packages/db/src/utils/btree.ts:329–346  ·  view source on GitHub ↗

* Scans the specified range of keys, in ascending order by key. * Note: the callback `onFound` must not insert or remove items in the * collection. Doing so may cause incorrect data to be sent to the * callback afterward. * @param low The first key scanned will be greater than or equal t

(
    low: K,
    high: K,
    includeHigh: boolean,
    onFound?: (k: K, v: V, counter: number) => { break?: R } | void,
    initialCounter?: number,
  )

Source from the content-addressed store, hash-verified

327 * @description Computational complexity: O(number of items scanned + log size)
328 */
329 forRange<R = number>(
330 low: K,
331 high: K,
332 includeHigh: boolean,
333 onFound?: (k: K, v: V, counter: number) => { break?: R } | void,
334 initialCounter?: number,
335 ): R | number {
336 const r = this._root.forRange(
337 low,
338 high,
339 includeHigh,
340 false,
341 this,
342 initialCounter || 0,
343 onFound,
344 )
345 return typeof r === `number` ? r : r.break!
346 }
347
348 /**
349 * Scans and potentially modifies values for a subsequence of keys.

Callers 5

hasMethod · 0.95
keysArrayMethod · 0.45
editRangeMethod · 0.45
forRangeMethod · 0.45
rangeQueryMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected