UNPKG

@variablesoftware/mock-d1

Version:

🎛️🗂️🧠 Mock D1 Database implementation for testing Cloudflare Workers

30 lines (29 loc) 764 B
/** * @file engine/where/whereParser.ts * @description Parses a SQL WHERE clause string into an AST for evaluation. */ export type WhereAstNode = { type: 'and'; left: WhereAstNode; right: WhereAstNode; } | { type: 'or'; left: WhereAstNode; right: WhereAstNode; } | { type: 'comparison'; column: string; operator: string; value: unknown; } | { type: 'isNull'; column: string; not: boolean; }; /** * Parses a WHERE clause string into an AST. (Stub: supports only simple equality and IS [NOT] NULL) * Throws a D1-like error for unsupported operators. * @param where - The WHERE clause string. * @returns WhereAstNode */ export declare function parseWhereClause(where: string, depth?: number): WhereAstNode;