UNPKG

@mfissehaye/string-to-drizzle-orm-filters

Version:
32 lines 1.2 kB
import { AnyColumn } from "drizzle-orm"; import { Program, DrizzleFilter } from "./ast"; /** * Defines the contract for column mapping, allowing string names to be resolved * to Drizzle's AnyColumn objects. This is crucial because the input string * uses string literals for column names, but Drizzle needs actual column objects. * * Example: { "id": users.id, "name": users.name } */ export type ColumnMap = Record<string, AnyColumn>; /** * The FilterGenerator class converts an AST (Abstract Syntax Tree) into * Drizzle ORM filter expressions. */ export declare class FilterGenerator { private columnMap; private drizzleOperators; constructor(columnMap: ColumnMap); /** * Generates a Drizzle ORM filter expression from the given AST. * * @param ast The root of the AST (Program node) to convert. * @returns A Drizzle ORM SQL expression (or undefined if the AST's expression is null). */ generate(ast: Program): DrizzleFilter | string | number; private traverseNode; /** * Handles CallExpression nodes, converting them into Drizzle ORM function calls. */ private handleCallExpression; } //# sourceMappingURL=generator.d.ts.map