@tanstack/db
Version:
A reactive client store for building super fast apps on sync
26 lines (25 loc) • 1.31 kB
TypeScript
import { BasicExpression } from '../ir.js';
/**
* Functions supported by the collection index system.
* These are the only functions that can be used in WHERE clauses
* that are pushed down to collection subscriptions for index optimization.
*/
export declare const SUPPORTED_COLLECTION_FUNCS: Set<string>;
/**
* Determines if a WHERE clause can be converted to collection-compatible BasicExpression format.
* This checks if the expression only uses functions supported by the collection index system.
*
* @param whereClause - The WHERE clause to check
* @returns True if the clause can be converted for collection index optimization
*/
export declare function isConvertibleToCollectionFilter(whereClause: BasicExpression<boolean>): boolean;
/**
* Converts a WHERE clause to BasicExpression format compatible with collection indexes.
* This function creates proper BasicExpression class instances that the collection
* index system can understand.
*
* @param whereClause - The WHERE clause to convert
* @param collectionAlias - The alias of the collection being filtered
* @returns The converted BasicExpression or null if conversion fails
*/
export declare function convertToBasicExpression(whereClause: BasicExpression<boolean>, collectionAlias: string): BasicExpression<boolean> | null;