You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Introduce explicity resource management to Transaction (neo4j#1155)
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 polyfill tools.
This feature enables the user begin a transaction 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.
Transaction will be closed using with the same behaviour as `Transaction.close` calls.
So, the transaction will be rollback if still open.
_Note: For better usage in cluster environments, you should use `executeRead` and `executeWrite` for handling retries._
Usage example:
```typescript
await using tx = session.beginTransaction()
await tx.run('CREATE (p:Person { name:$name }) RETURN p', { name }).summary()
await tx.commit()
```
0 commit comments