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.
11 lines (10 loc) • 943 B
TypeScript
import type { QuerySchema } from '../core/index.js';
import type { QueryOrderBy } from '../core/order-by.js';
import type { FieldPath, SchemaShape } from '../core/schema.js';
import type { QueryWhere } from '../core/where.js';
import type { SqlResult } from './types.js';
export declare const quoteIdent: (s: string) => string;
export declare const buildWhere: (where: QueryWhere, fieldToStr: (f: FieldPath) => string, placeholderForIndex: (i: number) => string, startIndex?: number) => SqlResult | undefined;
export declare const toSqlOrderBy: <TShape extends SchemaShape>(orderBy: QueryOrderBy<TShape>[] | undefined, fieldToStr: (f: FieldPath) => string) => SqlResult | undefined;
export declare const _toSql: <TShape extends SchemaShape>(json: QuerySchema<TShape>, fieldToStr: (f: FieldPath) => string, buildWhereFn: (w: QueryWhere, start?: number) => SqlResult | undefined) => SqlResult;
export type FieldToStr = (f: FieldPath) => string;