/**
 * Start PostgreSQL via pantry. No-op if already running.
 * Returns connection info.
 */
export declare function startPostgres(config?: PostgresConfig): Promise<PostgresConnection>;
/**
 * Stop PostgreSQL if it was started by startPostgres().
 */
export declare function stopPostgres(): Promise<void>;
/**
 * Returns `{ beforeAll, afterAll }` hooks for use in test suites.
 * Automatically starts postgres before tests and stops it after.
 *
 * @example
 * ```ts
 * const pg = usePostgres()
 * beforeAll(pg.beforeAll)
 * afterAll(pg.afterAll)
 *
 * test('can query', async () => {
 *   // pg.connection has { port, host, database, username }
 * })
 * ```
 */
export declare function usePostgres(config?: PostgresConfig): void;
/**
 * Run a function with a managed Postgres instance.
 * Starts before, stops after, cleans up on error.
 *
 * @example
 * ```ts
 * await withPostgres(async ({ port, host }) => {
 *   const db = connectToDb({ port, host })
 *   await db.query('SELECT 1')
 * })
 * ```
 */
export declare function withPostgres<T>(fn: (connection: PostgresConnection) => Promise<T> | T, config?: PostgresConfig): Promise<T>;
export declare interface PostgresConfig {
  port?: number
  host?: string
  database?: string
  username?: string
  stopAfter?: boolean
}
export declare interface PostgresConnection {
  port: number
  host: string
  database: string
  username: string
}
