@tanstack/db
Version:
A reactive client store for building super fast apps on sync
37 lines (36 loc) • 1.22 kB
JavaScript
;
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
class ReverseIndex {
constructor(index) {
this.originalIndex = index;
}
// Define the reversed operations
lookup(operation, value) {
const reverseOperation = operation === `gt` ? `lt` : operation === `gte` ? `lte` : operation === `lt` ? `gt` : operation === `lte` ? `gte` : operation;
return this.originalIndex.lookup(reverseOperation, value);
}
rangeQuery(options = {}) {
return this.originalIndex.rangeQueryReversed(options);
}
take(n, from, filterFn) {
return this.originalIndex.takeReversed(n, from, filterFn);
}
takeFromStart(n, filterFn) {
return this.originalIndex.takeReversedFromEnd(n, filterFn);
}
// All operations below delegate to the original index
supports(operation) {
return this.originalIndex.supports(operation);
}
get supportsRangeOptimization() {
return this.originalIndex.supportsRangeOptimization;
}
canOptimizeRangeFor(value) {
return this.originalIndex.canOptimizeRangeFor?.(value) ?? true;
}
get keyCount() {
return this.originalIndex.keyCount;
}
}
exports.ReverseIndex = ReverseIndex;
//# sourceMappingURL=reverse-index.cjs.map