Home Reference Source
import Transaction from 'neo4j-driver-core/lib/transaction.js'
public class | source

Transaction

Direct Subclass:

TransactionPromise

Represents a transaction in the Neo4j database.

Constructor Summary

Public Constructor
public

constructor(args: object)

Method Summary

Public Methods
public
public

close(): Promise<void>

Closes the transaction

public

commit(): Promise<void>

Commits the transaction and returns the result.

public

isOpen(): boolean

Check if this transaction is active, which means commit and rollback did not happen.

public

rollback(): Promise<void>

Rollbacks the transaction.

public

run(query: mixed, parameters: Object): Result

Run Cypher query Could be called with a query object i.e.: {text: "MATCH ...", parameters: {param: 1}} or with the query and parameters as separate arguments.

Public Constructors

public constructor(args: object) source

Params:

NameTypeAttributeDescription
args object
args.connectionHolder ConnectionHolder

the connection holder to get connection from.

args.onClose function()

Function to be called when transaction is committed or rolled back.

args.onBookmarks function(bookmarks: Bookmarks)

callback invoked when new bookmark is produced.

args.onConnection function()

Function to be called when a connection is obtained to ensure the conneciton is not yet released.

args.reactive boolean

whether this transaction generates reactive streams

args.fetchSize number

the record fetch size in each pulling batch.

args.impersonatedUser string

The name of the user which should be impersonated for the duration of the session.

args.highRecordWatermark number

The high watermark for the record buffer.

args.lowRecordWatermark number

The low watermark for the record buffer.

args.notificationFilter NotificationFilter

The notification filter used for this transaction.

args.apiTelemetryConfig NonAutoCommitApiTelemetryConfig

The api telemetry configuration. Empty/Null for disabling telemetry

Public Methods

public [Symbol.asyncDispose](): * source

Return:

*

public close(): Promise<void> source

Closes the transaction

This method will roll back the transaction if it is not already committed or rolled back.

Return:

Promise<void>

An empty promise if closed successfully or error if any error happened during

public commit(): Promise<void> source

Commits the transaction and returns the result.

After committing the transaction can no longer be used.

Return:

Promise<void>

An empty promise if committed successfully or error if any error happened during commit.

public isOpen(): boolean source

Check if this transaction is active, which means commit and rollback did not happen.

Return:

boolean

true when not committed and not rolled back, false otherwise.

public rollback(): Promise<void> source

Rollbacks the transaction.

After rolling back, the transaction can no longer be used.

Return:

Promise<void>

An empty promise if rolled back successfully or error if any error happened during rollback.

public run(query: mixed, parameters: Object): Result source

Run Cypher query Could be called with a query object i.e.: {text: "MATCH ...", parameters: {param: 1}} or with the query and parameters as separate arguments.

Params:

NameTypeAttributeDescription
query mixed

Cypher query to execute

parameters Object

Map with parameters to use in query

Return:

Result

New Result