Skip to main content
Module

x/kysely_deno_postgres_dialect/mod.ts>postgres.Pool#end

Kysely dialect for PostgreSQL using the deno-postgres client.
Latest
method postgres.Pool.prototype.end
import { postgres } from "https://deno.land/x/kysely_deno_postgres_dialect@v0.27.1/mod.ts";
const { Pool } = postgres;

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

import { Pool } from "./pool.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 "./pool.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>