Class: Neo4j::Driver::Transaction

Inherits:
Object
  • Object
show all
Defined in:
lib/neo4j/driver/transaction.rb

Overview

The transaction context yielded to execute_read / execute_write work blocks. It deliberately exposes only #run: the driver owns the lifecycle of a managed transaction (auto-commit on clean return, rollback + retry on failure), so the block must not commit, roll back, or close it.

This is Neo4j::Driver::Transaction on both flavours — the JRuby flavour binds the constant to Java's DelegatingTransactionContext — so downstream code prepending onto Neo4j::Driver::Transaction targets the managed context consistently. Explicit transactions (session.begin_transaction) use UnmanagedTransaction, which keeps commit/rollback/close.

Instance Method Summary collapse

Constructor Details

#initialize(transaction) ⇒ Transaction

Returns a new instance of Transaction.



16
17
18
# File 'lib/neo4j/driver/transaction.rb', line 16

def initialize(transaction)
  @transaction = transaction
end

Instance Method Details

#run(query, **parameters) ⇒ Object



20
21
22
# File 'lib/neo4j/driver/transaction.rb', line 20

def run(query, **parameters)
  @transaction.run(query, **parameters)
end