Skip to content

Symbol.asyncDispose support #1094

@mfulton26

Description

@mfulton26

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions