@tanstack/db
Version:
A reactive client store for building super fast apps on sync
30 lines (29 loc) • 1.18 kB
TypeScript
import { BaseIndex } from '../indexes/base-index.js';
import { BasicExpression } from '../query/ir.js';
/**
* Result of index-based query optimization
*/
export interface OptimizationResult<TKey> {
canOptimize: boolean;
matchingKeys: Set<TKey>;
}
/**
* Finds an index that matches a given field path
*/
export declare function findIndexForField<TKey extends string | number>(indexes: Map<number, BaseIndex<TKey>>, fieldPath: Array<string>): BaseIndex<TKey> | undefined;
/**
* Intersects multiple sets (AND logic)
*/
export declare function intersectSets<T>(sets: Array<Set<T>>): Set<T>;
/**
* Unions multiple sets (OR logic)
*/
export declare function unionSets<T>(sets: Array<Set<T>>): Set<T>;
/**
* Optimizes a query expression using available indexes to find matching keys
*/
export declare function optimizeExpressionWithIndexes<TKey extends string | number>(expression: BasicExpression, indexes: Map<number, BaseIndex<TKey>>): OptimizationResult<TKey>;
/**
* Checks if an expression can be optimized
*/
export declare function canOptimizeExpression<TKey extends string | number>(expression: BasicExpression, indexes: Map<number, BaseIndex<TKey>>): boolean;