import type { DatabaseClient } from '../database/database-client.interface'; /** * Prepared query for efficient reusable parameterized queries. * * Prepared queries build the SQL once and allow multiple executions * with different parameter values. This is useful for: * 1. Query building optimization - Build SQL once, execute many times * 2. Type-safe placeholders - Named parameters with validation * 3. Developer ergonomics - Cleaner API for reusable queries * * @example * const getUserById = db.users * .where(u => eq(u.id, sql.placeholder('userId'))) * .prepare('getUserById'); * * await getUserById.execute({ userId: 10 }); * await getUserById.execute({ userId: 20 }); * * @example * // Multiple placeholders * const searchUsers = db.users * .where(u => and( * gt(u.age, sql.placeholder('minAge')), * like(u.name, sql.placeholder('namePattern')) * )) * .prepare('searchUsers'); * * await searchUsers.execute({ minAge: 18, namePattern: '%john%' }); */ export declare class PreparedQuery = Record> { private readonly sql; private readonly placeholderMap; private readonly paramCount; private readonly client; private readonly transformFn; readonly name: string; /** * @param sql - The prepared SQL query string with $1, $2, etc. placeholders * @param placeholderMap - Map of placeholder names to their 1-indexed parameter positions * @param paramCount - Total number of parameters in the query * @param client - The database client for execution * @param transformFn - Function to transform raw database rows to the result type * @param name - Optional name for the prepared query (for debugging) */ constructor(sql: string, placeholderMap: Map, paramCount: number, client: DatabaseClient, transformFn: (rows: any[]) => TResult[], name: string); /** * Execute the prepared query with the given parameters * * @param params - Object mapping placeholder names to their values * @returns Promise resolving to the query results * @throws Error if a required placeholder parameter is missing * * @example * const result = await preparedQuery.execute({ userId: 10 }); */ execute(params: TParams): Promise; /** * Get the prepared SQL string (for debugging) */ getSql(): string; /** * Get the placeholder names used in this query */ getPlaceholderNames(): string[]; } //# sourceMappingURL=prepared-query.d.ts.map