UNPKG

convex

Version:

Client for the Convex Cloud

64 lines 2.38 kB
import { JSONValue } from "../../values/index.js"; import { PaginationResult, PaginationOptions } from "../pagination.js"; import { Query, QueryInitializer } from "../query.js"; import { Expression, FilterBuilder } from "../filter_builder.js"; import { GenericTableInfo } from "../data_model.js"; import { IndexRangeBuilderImpl, SerializedRangeExpression } from "./index_range_builder_impl.js"; declare type QueryOperator = { filter: JSONValue; } | { limit: number; }; declare type Source = { type: "FullTableScan"; tableName: string; order: "asc" | "desc"; } | { type: "IndexRange"; indexName: string; range: ReadonlyArray<SerializedRangeExpression>; order: "asc" | "desc"; }; declare type SerializedQuery = { source: Source; operators: Array<QueryOperator>; }; export declare class QueryInitializerImpl implements QueryInitializer<GenericTableInfo> { private tableName; constructor(tableName: string); withIndex(indexName: string, indexRange: (q: IndexRangeBuilderImpl) => IndexRangeBuilderImpl): QueryImpl; fullTableScan(): QueryImpl; order(order: "asc" | "desc"): QueryImpl; count(): Promise<number>; filter(predicate: (q: FilterBuilder<GenericTableInfo>) => Expression<boolean>): QueryImpl; limit(n: number): QueryImpl; collect(): Promise<any[]>; take(n: number): Promise<Array<any>>; paginate(options: PaginationOptions): Promise<PaginationResult<any>>; first(): Promise<any>; unique(): Promise<any>; [Symbol.asyncIterator](): AsyncIterableIterator<any>; } declare class QueryImpl implements Query<GenericTableInfo> { private state; constructor(query: SerializedQuery); private takeQuery; private startQuery; private closeQuery; order(order: "asc" | "desc"): QueryImpl; filter(predicate: (q: FilterBuilder<GenericTableInfo>) => Expression<boolean>): QueryImpl; limit(n: number): QueryImpl; [Symbol.asyncIterator](): AsyncIterableIterator<any>; next(): Promise<IteratorResult<any>>; return(): Promise<{ done: boolean; value: undefined; }>; paginate(options: PaginationOptions): Promise<PaginationResult<any>>; collect(): Promise<Array<any>>; take(n: number): Promise<Array<any>>; first(): Promise<any | null>; unique(): Promise<any | null>; } export {}; //# sourceMappingURL=query_impl.d.ts.map