Add support for the new using keyword#500
Merged
peter-leonov-ch merged 10 commits intomainfrom Dec 17, 2025
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
ab61171 to
fbaf5ea
Compare
using keyword
using keywordusing keyword
Contributor
There was a problem hiding this comment.
Pull request overview
This PR implements support for JavaScript's explicit resource management (using keyword) by adding Symbol.dispose and Symbol.asyncDispose methods to the client and result set classes. This enables automatic cleanup when these resources are used with the using and await using statements.
Key Changes:
- Added disposal methods to
ClickHouseClient,ResultSet(web), andResultSet(node) classes - Created feature detection utilities and test helpers for the
usingstatement - Added comprehensive unit tests for the new disposal functionality
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/client-web/src/result_set.ts | Added Symbol.asyncDispose method to web ResultSet for async disposal |
| packages/client-node/src/result_set.ts | Added Symbol.dispose method to Node.js ResultSet for sync disposal |
| packages/client-common/src/client.ts | Added Symbol.asyncDispose method to ClickHouseClient for async disposal |
| packages/client-web/tests/utils/sleep.ts | Added sleep utility function for async test delays |
| packages/client-web/tests/utils/feature_detection.ts | Added feature detection for using statement support |
| packages/client-web/tests/unit/web_result_set.test.ts | Added test for ResultSet disposal with await using statement |
| packages/client-web/tests/unit/web_client.test.ts | Added test for client disposal with await using statement |
| packages/client-node/tests/utils/sleep.ts | Added sleep utility function for async test delays |
| packages/client-node/tests/utils/feture_detection.ts | Added feature detection for using statement support |
| packages/client-node/tests/unit/node_result_set.test.ts | Added test for ResultSet disposal with using statement |
| packages/client-node/tests/unit/node_client.test.ts | Added test for client disposal with await using statement |
| packages/client-common/tests/unit/client.test.ts | Added test for common client disposal with await using statement |
| CHANGELOG.md | Documented the new Disposable API support feature |
Comments suppressed due to low confidence (1)
packages/client-node/tests/utils/feture_detection.ts:1
- Corrected spelling of 'feture' to 'feature' in filename.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
peter-leonov-ch
commented
Dec 17, 2025
peter-leonov-ch
commented
Dec 17, 2025
slvrtrn
approved these changes
Dec 17, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements #492
It allows for tricks like:
What
For the future:
sleep()Checklist
Delete items not relevant to your PR: