longcelot-sheet-db
Version:
Google Sheets-backed staging database adapter for Node.js with schema-first design
35 lines • 1.67 kB
TypeScript
import { WhereClause } from '../../schema/types';
import { SQLDialect } from './dialect';
export interface BuiltQuery {
text: string;
params: unknown[];
}
/** Tenant-scoping column/value pair — see accessControl.ts / FAQ.md #13 for what this generalizes. */
export interface TenantScope {
column: string;
value: string;
}
interface WhereOptions {
where?: WhereClause;
tenant?: TenantScope;
softDeleteColumn?: string;
includeDeleted?: boolean;
}
export declare function buildSelect(dialect: SQLDialect, table: string, options: WhereOptions & {
orderBy?: string;
order?: 'asc' | 'desc';
limit?: number;
offset?: number;
}): BuiltQuery;
export declare function buildCount(dialect: SQLDialect, table: string, options: WhereOptions): BuiltQuery;
export declare function buildInsert(dialect: SQLDialect, table: string, row: Record<string, unknown>): BuiltQuery;
export declare function buildInsertMany(dialect: SQLDialect, table: string, rows: Record<string, unknown>[]): BuiltQuery;
/**
* No soft-delete filtering here — matches CRUDOperations.update(), which scans/updates
* regardless of `_deleted_at` (only findMany/findOne/count exclude soft-deleted rows by default).
*/
export declare function buildUpdate(dialect: SQLDialect, table: string, data: Record<string, unknown>, where: WhereClause, tenant?: TenantScope): BuiltQuery;
/** Real hard delete — only used when schema.softDelete is false; soft-delete routes through buildUpdate. */
export declare function buildDelete(dialect: SQLDialect, table: string, where: WhereClause, tenant?: TenantScope): BuiltQuery;
export {};
//# sourceMappingURL=queryBuilder.d.ts.map