Symbol.asyncDispose support
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 8.7k
- Forks
- 374
- Avg merge
- 11d 16h
- Merged PRs (30d)
- 1
Description
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);
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the postgres.Sql API and compare its current connection lifecycle with the TC39 Explicit Resource Management proposal. Verify that await using sql = postgres() supports Symbol.asyncDispose and closes the connection with the same effect as await sql.end(); the issue provides no file or test path, so locate the existing lifecycle tests first.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, postgresql
- Domain
- backend-api-design, databases
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100