Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

RihanArfan
Copy link

@RihanArfan RihanArfan commented Sep 19, 2025

using syntax requires Node.js v22 and above

Adds using support to automatically close the database connection

@atinux atinux requested a review from pi0 September 19, 2025 05:53
Copy link

codecov bot commented Sep 19, 2025

Codecov Report

❌ Patch coverage is 20.98765% with 64 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@e77bfed). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/connectors/sqlite3.ts 15.38% 11 Missing ⚠️
src/connectors/pglite.ts 18.18% 9 Missing ⚠️
src/database.ts 20.00% 8 Missing ⚠️
src/connectors/bun-sqlite.ts 0.00% 7 Missing ⚠️
src/connectors/postgresql.ts 25.00% 6 Missing ⚠️
src/connectors/better-sqlite3.ts 28.57% 5 Missing ⚠️
src/connectors/libsql/core.ts 16.66% 5 Missing ⚠️
src/connectors/mysql2.ts 28.57% 5 Missing ⚠️
src/connectors/node-sqlite.ts 16.66% 5 Missing ⚠️
src/connectors/planetscale.ts 33.33% 2 Missing ⚠️
... and 1 more
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #178   +/-   ##
=======================================
  Coverage        ?   56.36%           
=======================================
  Files           ?       22           
  Lines           ?      841           
  Branches        ?      114           
=======================================
  Hits            ?      474           
  Misses          ?      365           
  Partials        ?        2           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pi0
Copy link
Member

pi0 commented Sep 19, 2025

Can you please ask a test for close? (should be last)

@RihanArfan
Copy link
Author

Added a test :)

@pi0
Copy link
Member

pi0 commented Sep 19, 2025

Additionally, i think it would be nice to flag disposed instances so they won't be reused anymore. Also we should reject any new query or prepares when drivers are disposed. (it can be added in abstract wrapper with a .disposed flag)

@RihanArfan
Copy link
Author

Is the abstract wrapper database.ts or are you suggesting creating a new one?

@pi0
Copy link
Member

pi0 commented Sep 22, 2025

yes, database.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants