Skip to content

Introduce explicity resource management to Driver and Session objects #1154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

bigmontz
Copy link
Contributor

This is a TC39 proposal which is already implemented in Typescript 5.2, core-js, babel and other polyfill tools.

This feature enables the user create the driver or a session with the await using keywords and then do not have to close the resource afterwards, since this resources will be closed after leaving the block which were created at.

For example:

await using driver = neo4j.driver(uri, authToken)
await using session = driver.session()

await session.executeRead(tx => "RETURN 1")

Since Deno is more strict with typescript, small fixes had to be done in the driver.

  • Add a value to Result[Symbol.toStringTag].
  • Fix Integer.shiftRight function to add proper integer conversion it.

A package.json file was added to the neo4j-driver-deno folder for making easier to integrate the test runners to the environments.

This is a TC39 [proposal](https://github.com/tc39/proposal-explicit-resource-management) which is already implemented in Typescript 5.2, core-js, babel and other pollifyl tools.

This feature enables the user create the driver or a session with the `await using` keywords and then do not have to close the resource afterwards, since this resources will be closed after leaving the block which were created at.

For example:

```typescript
await using driver = neo4j.driver(uri, authToken)
await using session = driver.session()

await session.executeRead(tx => "RETURN 1")
```

Since Deno is more strict with typescript, small fixes had to be done in the driver.

* Add a value to Result[Symbol.toStringTag].
* Fix Integer.shiftRight function to add propert integer convertion it.

A package.json file was added to the `neo4j-driver-deno` folder for making easier to integrate the test runners to the environments.
@bigmontz bigmontz marked this pull request as draft October 26, 2023 12:24
@bigmontz bigmontz marked this pull request as ready for review October 26, 2023 14:34
@bigmontz bigmontz merged commit e191168 into neo4j:5.0 Oct 26, 2023
@bigmontz bigmontz deleted the 5.x-add-explicity-resource-management-to-session-and-driver branch October 26, 2023 19:30
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