UNPKG

agnostic-query

Version:

Type-safe fluent builder for portable query schemas. Runtime-agnostic, database-agnostic — the same QuerySchema drives Drizzle, Kysely, db0, or raw SQL.

18 lines (17 loc) 1.17 kB
import { type LoadSubsetOptions, parseOrderByExpression, parseWhereExpression } from '@tanstack/db'; import type { QuerySchema } from './core/index.js'; import type { QueryOrderBy } from './core/order-by.js'; import type { SchemaShape } from './core/schema.js'; import { type QueryWhere } from './core/where.js'; export type FromTanDbWhereParam = Parameters<typeof parseWhereExpression>[0]; export declare const fromTanDbWhere: <TShape extends SchemaShape>(where: FromTanDbWhereParam) => QueryWhere<TShape> | null | undefined; /** * 与默认解析器 结构相同 * * 注意:`parseOrderByExpression` 内部数组输入走 `Array.isArray` 检查, * 但 null/undefined 不会触发该分支,会返回空数组 `[]`。 * 空数组会在这里直接折叠为 `undefined`,避免进入解析器并生成空排序。 */ export type FromTanDbOrderByParam = Parameters<typeof parseOrderByExpression>[0]; export declare const fromTanDbOrderBy: <TShape extends SchemaShape>(orderBy: FromTanDbOrderByParam) => QueryOrderBy<TShape>[] | undefined; export declare const fromTanDb: <TShape extends SchemaShape>(loadSubsetOptions?: LoadSubsetOptions) => QuerySchema<TShape>;