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 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:
await using tx = session.beginTransaction()
await tx.run('CREATE (p:Person { name:$name }) RETURN p', { name }).summary()
await tx.commit()
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 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
andexecuteWrite
for handling retries.Usage example: