import { type CursorIterator, PostgresPool, type QueryParams } from './pool.js'; declare const defaultPool: PostgresPool; export { defaultPool, type CursorIterator, type QueryParams }; /** * Creates a new connection pool and attempts to connect to the database. */ export declare const initAsync: (pgConfig: import("./pool.js").PostgresPoolConfig, idleErrorHandler: (error: Error, client: import("pg").PoolClient) => void) => Promise; /** * Closes the connection pool. */ export declare const closeAsync: () => Promise; /** * Gets a new client from the connection pool. The caller MUST call `release()` to * release the client, whether or not errors occurred while using * `client`. The client can call `done(truthy_value)` to force * destruction of the client, but this should not be used except in * unusual circumstances. */ export declare const getClientAsync: () => Promise; /** * Performs a query with the given client. */ export declare const queryWithClientAsync: (client: import("pg").default.PoolClient, sql: string, params: QueryParams) => Promise; /** * Performs a query with the given client. Errors if the query returns more * than one row. */ export declare const queryWithClientOneRowAsync: (client: import("pg").default.PoolClient, sql: string, params: QueryParams) => Promise; /** * Performs a query with the given client. Errors if the query returns more * than one row. */ export declare const queryWithClientZeroOrOneRowAsync: (client: import("pg").default.PoolClient, sql: string, params: QueryParams) => Promise; /** * Rolls back the current transaction for the given client. */ export declare const rollbackWithClientAsync: (client: import("pg").default.PoolClient) => Promise; export declare const beginTransactionAsync: () => Promise; /** * Commits the transaction if err is null, otherwise rollbacks the transaction. * Also releases the client. */ export declare const endTransactionAsync: (client: import("pg").default.PoolClient, err: Error | null | undefined) => Promise; /** * Runs the specified function inside of a transaction. The function will * receive a database client as an argument, but it can also make queries * as usual, and the correct client will be used automatically. * * The transaction will be rolled back if the function throws an error, and * will be committed otherwise. */ export declare const runInTransactionAsync: (fn: (client: import("pg").default.PoolClient) => Promise) => Promise; /** * Calls a sproc with the specified parameters using a specific client. */ export declare const callWithClientAsync: (client: import("pg").default.PoolClient, functionName: string, params: any[]) => Promise; /** * Calls a sproc with the specified parameters using a specific client. * Errors if the sproc does not return exactly one row. */ export declare const callWithClientOneRowAsync: (client: import("pg").default.PoolClient, functionName: string, params: any[]) => Promise; /** * Calls a sproc with the specified parameters using a specific client. * Errors if the sproc returns more than one row. */ export declare const callWithClientZeroOrOneRowAsync: (client: import("pg").default.PoolClient, functionName: string, params: any[]) => Promise; /** * Executes a query with the specified parameters. Returns an array of rows * that conform to the given Zod schema. */ export declare const queryRows: { (sql: string, model: Model): Promise[]>; (sql: string, params: QueryParams, model: Model): Promise[]>; }; /** * Executes a query with the specified parameters. Returns exactly one row that conforms to the given Zod schema. */ export declare const queryRow: { (sql: string, model: Model): Promise>; (sql: string, params: QueryParams, model: Model): Promise>; }; /** * Executes a query with the specified parameters. Returns either null or a * single row that conforms to the given Zod schema, and errors otherwise. */ export declare const queryOptionalRow: { (sql: string, model: Model): Promise | null>; (sql: string, params: QueryParams, model: Model): Promise | null>; }; /** * Calls the given sproc with the specified parameters. * Errors if the sproc does not return anything. */ export declare const callRows: { (sql: string, model: Model): Promise[]>; (sql: string, params: any[], model: Model): Promise[]>; }; /** * Calls the given sproc with the specified parameters. * Returns exactly one row from the sproc that conforms to the given Zod schema. */ export declare const callRow: { (sql: string, model: Model): Promise>; (sql: string, params: any[], model: Model): Promise>; }; /** * Calls the given sproc with the specified parameters. Returns either null * or a single row that conforms to the given Zod schema. */ export declare const callOptionalRow: { (sql: string, model: Model): Promise | null>; (sql: string, params: any[], model: Model): Promise | null>; }; /** * Executes a query and returns all values from a single column, validated * against the given Zod schema. Errors if the query returns more than one column. */ export declare const queryScalars: { (sql: string, model: Model): Promise[]>; (sql: string, params: QueryParams, model: Model): Promise[]>; }; /** * Executes a query and returns a single value from a single column, validated * against the given Zod schema. Errors if the query does not return exactly * one row or returns more than one column. */ export declare const queryScalar: { (sql: string, model: Model): Promise>; (sql: string, params: QueryParams, model: Model): Promise>; }; /** * Executes a query and returns a single value from a single column, or null * if no rows are returned. Validated against the given Zod schema. Errors if * the query returns more than one row or more than one column. */ export declare const queryOptionalScalar: { (sql: string, model: Model): Promise | null>; (sql: string, params: QueryParams, model: Model): Promise | null>; }; /** * Calls the given sproc and returns all values from a single column, validated * against the given Zod schema. Errors if the sproc returns more than one column. */ export declare const callScalars: { (sql: string, model: Model): Promise[]>; (sql: string, params: any[], model: Model): Promise[]>; }; /** * Calls the given sproc and returns a single value from a single column, validated * against the given Zod schema. Errors if the sproc does not return exactly * one row or returns more than one column. */ export declare const callScalar: { (sql: string, model: Model): Promise>; (sql: string, params: any[], model: Model): Promise>; }; /** * Calls the given sproc and returns a single value from a single column, or * null if no rows are returned. Validated against the given Zod schema. * Errors if the sproc returns more than one row or more than one column. */ export declare const callOptionalScalar: { (sql: string, model: Model): Promise | null>; (sql: string, params: any[], model: Model): Promise | null>; }; /** * Executes a query with the specified parameters. Returns the number of rows affected. */ export declare const execute: (sql: string, params?: QueryParams) => Promise; /** * Executes a query with the specified parameter, and errors if the query doesn't return exactly one row. */ export declare const executeRow: (sql: string, params?: QueryParams) => Promise; /** * Returns an {@link CursorIterator} that can be used to iterate over the * results of the query in batches, which is useful for large result sets. * Each row will be parsed by the given Zod schema. */ export declare const queryCursor: { (sql: string, model: Model): Promise>>; (sql: string, params: QueryParams, model: Model): Promise>>; }; /** * Set the schema to use for the search path. * * @param schema The schema name to use (can be "null" to unset the search path) */ export declare const setSearchSchema: (schema: string | null) => Promise; /** * Get the schema that is currently used for the search path. * * @returns schema in use (may be `null` to indicate no schema) */ export declare const getSearchSchema: () => string | null; /** * Generate, set, and return a random schema name. * * @param prefix The prefix of the new schema, only the first 28 characters will be used (after lowercasing). * @returns The randomly-generated search schema. */ export declare const setRandomSearchSchemaAsync: (prefix: string) => Promise; /** * Deletes all schemas starting with the given prefix. * * @param prefix The prefix of the schemas to delete. */ export declare const clearSchemasStartingWith: (prefix: string) => Promise; //# sourceMappingURL=default-pool.d.ts.map