Module

x/postgres/pool.ts>Pool#end

PostgreSQL driver for Deno
Extremely Popular
Go to Latest
method Pool.prototype.end
import { Pool } from "https://dotland.deno.dev/x/postgres@v0.17.2/pool.ts";

This will close all open connections and set a terminated status in the pool

import { Pool } from "https://deno.land/x/postgres/mod.ts";
const pool = new Pool({}, 10);

await pool.end();
console.assert(pool.available === 0, "There are connections available after ending the pool");
await pool.end(); // An exception will be thrown, pool doesn't have any connections to close

However, a terminated pool can be reused by using the "connect" method, which will reinitialize the connections according to the original configuration of the pool

import { Pool } from "https://deno.land/x/postgres/mod.ts";
const pool = new Pool({}, 10);
await pool.end();
const client = await pool.connect();
await client.queryArray`SELECT 1`; // Works!
client.release();

Returns

Promise<void>