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

TransactionPromise

Extends:

Transaction → TransactionPromise

Represents a {@link Promise<Transaction>} object and a Transaction object.

Resolving this object promise verifies the result of the transaction begin and returns the Transaction object in case of success.

The object can still also used as Transaction for convenience. The result of begin will be checked during the next API calls in the object as it is in the transaction.

Constructor Summary

Public Constructor
public

constructor(args: object)

Member Summary

Public Members
public

[_a]: string

Method Summary

Public Methods
public

catch(onRejected: function(error: Neo4jError)): Promise

Catch errors when using promises.

public

finally(onfinally: function() | null): Promise

Called when finally the begin is done

public

then(onFulfilled: function(transaction: Transaction), onRejected: function(error: {message: string, code: string})): Promise

Waits for the begin to complete.

Inherited Summary

From class Transaction
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

Override:

Transaction#constructor

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 connection 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.notificationFilter NotificationFilter

The notification filter used for this transaction.

args.apiTelemetryConfig NonAutoCommitApiTelemetryConfig

The api telemetry configuration. Empty/Null for disabling telemetry

Public Members

public [_a]: string source

Public Methods

public catch(onRejected: function(error: Neo4jError)): Promise source

Catch errors when using promises.

Params:

NameTypeAttributeDescription
onRejected function(error: Neo4jError)

Function to be called upon errors.

Return:

Promise

promise.

public finally(onfinally: function() | null): Promise source

Called when finally the begin is done

Params:

NameTypeAttributeDescription
onfinally function() | null

function when the promise finished

Return:

Promise

promise.

public then(onFulfilled: function(transaction: Transaction), onRejected: function(error: {message: string, code: string})): Promise source

Waits for the begin to complete.

Params:

NameTypeAttributeDescription
onFulfilled function(transaction: Transaction)

function to be called when finished.

onRejected function(error: {message: string, code: string})

function to be called upon errors.

Return:

Promise

promise.