/** * @license * Copyright 2025 Steven Roussey * SPDX-License-Identifier: Apache-2.0 */ export interface RegisteredIndex { readonly name: string; readonly keyPath: readonly string[]; } export interface PickCoveringIndexInput { readonly table: string; readonly indexes: readonly RegisteredIndex[]; readonly criteriaColumns: readonly string[]; readonly orderByColumns: ReadonlyArray<{ readonly column: string; readonly direction: "ASC" | "DESC"; }>; readonly selectColumns: readonly string[]; readonly primaryKeyColumns: readonly string[]; } export interface PickedIndex { readonly name: string; readonly keyPath: readonly string[]; /** true if the keypath order is reverse of orderBy direction (caller uses "prev" cursor) */ readonly reverseDirection: boolean; } /** * Pick the first registered index whose keypath: * 1. starts with all `criteriaColumns` (as a prefix, in any order), * 2. then has the `orderByColumns` immediately after, in matching direction or reversed, * 3. and contains every `selectColumns` value somewhere in the keypath * (primary-key columns are considered covered for free, e.g. via cursor.primaryKey). * * Throws {@link CoveringIndexMissingError} on no match. */ export declare function pickCoveringIndex(input: PickCoveringIndexInput): PickedIndex; //# sourceMappingURL=coveringIndexPicker.d.ts.map