postgres icon indicating copy to clipboard operation
postgres copied to clipboard

Symbol.asyncDispose support

Open mfulton26 opened this issue 5 months ago • 0 comments

I propose support AsyncDisposable on postgres.Sql (https://github.com/tc39/proposal-explicit-resource-management) so that developers can opt-into ending the connection automatically at the end of the current scope.

before

import postgres from "postgres";

const sql = postgres();

const result = await sql`SELECT * FROM some_table`;

console.log(result);

await sql.end();

after

import postgres from "postgres";

await using sql = postgres();

const result = await sql`SELECT * FROM some_table`;

console.log(result);

mfulton26 avatar Jul 17 '25 20:07 mfulton26