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

Transaction

Represents a transaction in the Neo4j database.

Constructor Summary

Public Constructor
public

constructor(connectionHolder: ConnectionHolder, onClose: function(), onBookmark: function(bookmark: Bookmark))

Method Summary

Public Methods
public

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

Rollbacks the transaction.

public

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

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

Public Constructors

public constructor(connectionHolder: ConnectionHolder, onClose: function(), onBookmark: function(bookmark: Bookmark)) source

Params:

NameTypeAttributeDescription
connectionHolder ConnectionHolder

the connection holder to get connection from.

onClose function()

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

onBookmark function(bookmark: Bookmark)

callback invoked when new bookmark is produced.

Public Methods

public commit(): Result source

Commits the transaction and returns the result.

After committing the transaction can no longer be used.

Return:

Result

New Result

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(): Result source

Rollbacks the transaction.

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

Return:

Result

New Result

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

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

Params:

NameTypeAttributeDescription
statement mixed

Cypher statement to execute

parameters Object

Map with parameters to use in statement

Return:

Result

New Result