Class: Neo4j::Core::CypherSession::Transactions::Base

Inherits:
Transaction::Base show all
Defined in:
lib/neo4j/core/cypher_session/transactions.rb

Direct Known Subclasses

Bolt, Driver, Embedded, HTTP

Instance Attribute Summary

Attributes inherited from Transaction::Base

#root, #session

Instance Method Summary collapse

Methods inherited from Transaction::Base

#autoclosed!, #close, #closed?, #commit, #delete, #expired?, #failed?, #initialize, #inspect, #mark_expired, #mark_failed, #root?

Constructor Details

This class inherits a constructor from Neo4j::Transaction::Base

Instance Method Details

#after_commit(&block) ⇒ Object



28
29
30
# File 'lib/neo4j/core/cypher_session/transactions.rb', line 28

def after_commit(&block)
  after_commit_registry << block
end

#after_commit_registryObject



24
25
26
# File 'lib/neo4j/core/cypher_session/transactions.rb', line 24

def after_commit_registry
  @after_commit_registry ||= []
end

#post_close!Object



32
33
34
35
# File 'lib/neo4j/core/cypher_session/transactions.rb', line 32

def post_close!
  super
  after_commit_registry.each(&:call) unless failed?
end

#queries(options = {}, &block) ⇒ Object



20
21
22
# File 'lib/neo4j/core/cypher_session/transactions.rb', line 20

def queries(options = {}, &block)
  adaptor.queries(@session, {transaction: self}.merge(options), &block)
end

#query(*args) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/neo4j/core/cypher_session/transactions.rb', line 8

def query(*args)
  options = if args[0].is_a?(::Neo4j::Core::Query)
              args[1] ||= {}
            else
              args[1] ||= {}
              args[2] ||= {}
            end
  options[:transaction] ||= self

  adaptor.query(@session, *args)
end