feat: Add support of using
keyword for driver and session management
#353
Labels
enhancement
New feature or request
using
keyword for driver and session management
#353
Feature Request
Describe the Feature Request
The YDB SDK, like many database SDKs, offers interfaces for establishing sessions and
interacting with the database through a driver. The addition of TypeScript support, specifically for a
using
keyword, would introduce several benefits for developers working with YDB.
As the support of this keyword was introduced
in Typecscript 5.2, it would be great if its support will be added to the SDK.
Resource Management: The primary advantage of a
using
construct is automatic resource management. In the context of YDB, this would ensure that database sessions and connections are properly closed or disposed of once they are no longer needed, reducing the risk of resource leaks that could lead to performance issues or exceeding resource limits.Code Clarity and Maintenance: Using a
using
construct makes the scope of resource usage clear. It delineates where resources are started to be used and where they are released, making the code easier to understand and maintain. This is particularly beneficial in complex applications where resource management is critical.Promote Best Practices: Encouraging the use of a
using
pattern or similar construct can promote best practices among developers. It makes resource management a more integral part of the development process, encouraging developers to think about the lifecycle of the resources they use.Asynchronous Support: With the modern TypeScript ecosystem heavily relying on asynchronous operations, especially in the context of database operations, integrating using with async/await patterns would make managing asynchronous database sessions and connections more intuitive. This would allow developers to write non-blocking code while ensuring resources are automatically managed.
Describe Alternatives
I personally find callback approach for managing sessions a little bit cumbersome and I think that developer experience will be much smoother after this change.
Additional Context
Short introduction into
using
If the feature request is approved, would you be willing to submit a PR?
No
The text was updated successfully, but these errors were encountered: