postgres
postgres copied to clipboard
Symbol.asyncDispose support
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);