/** * Lightweight SQL builder for PostgreSQL. * Replaces squel dependency with minimal overhead — builds SQL strings * directly with $N numbered parameter placeholders. */ /** * Result of a parameterized query build */ export interface ParamResult { text: string; values: unknown[]; } /** * Escape literal `?` characters in a SQL fragment so they survive placeholder * substitution, then convert `$N` parameters back to `?` placeholders. * * Used when embedding an already-built subquery into an outer query: the outer * builder re-numbers `?` placeholders, so any literal `?` the subquery contains * (e.g. the JSONB `?` / `?&` / `?|` operators) must be escaped to `??` first. */ export declare function toPlaceholders(sql: string): string; /** * Minimal SELECT query builder for PostgreSQL. * Produces parameterized queries with $1, $2, ... placeholders. * Uses parallel arrays instead of object arrays to minimize allocations. */ export declare class SelectBuilder { private _table; private _fields; private _joins; private _wConds; private _wVals; private _groups; private _hConds; private _hVals; private _orders; private _limit; private _offset; from(table: string): this; field(expr: string, _alias?: string): this; fields(fieldList: string[]): this; join(tableRef: string, _alias: undefined, on: string): this; left_join(tableRef: string, _alias: undefined, on: string): this; right_join(tableRef: string, _alias: undefined, on: string): this; where(condition: string, ...values: unknown[]): this; /** * Add WHERE clause with values as array (avoids spread overhead) */ whereArr(condition: string, values: unknown[]): this; group(field: string): this; having(condition: string, values: unknown[]): this; order(column: string, asc: boolean): this; limit(n: number): this; offset(n: number): this; /** * Build parameterized query with $1, $2, ... placeholders */ toParam(): ParamResult; /** * Build SQL string with inline values (for debugging / subqueries) */ toString(): string; } /** * Create a new SELECT builder */ export declare function select(): SelectBuilder; //# sourceMappingURL=sql-builder.d.ts.map