@atomist/sdm-pack-aspect
Version:
an Atomist SDM Extension Pack for visualizing drift across an organization
17 lines • 880 B
TypeScript
import { PoolClient } from "pg";
export declare type ClientFactory = () => Promise<PoolClient>;
/**
* Perform the given operations with a database client connection
*
* Connection errors result in an exception.
* Errors thrown by the passed-in function result are logged, and the
* provided defaultResult is returned (or else undefined).
*
* @param {() => } clientFactory factory for clients
* @param {(c: ) => Promise<R>} what a function to run with the client
* @param {R} defaultResult return this in case of error. If not provided, return undefined
* @param description description of what we're doing. Allows for timing
* @return {Promise<R>}
*/
export declare function doWithClient<R>(description: string, clientFactory: ClientFactory, what: (c: PoolClient) => Promise<R>, defaultResult?: R | ((e: Error) => R)): Promise<R>;
//# sourceMappingURL=pgUtils.d.ts.map