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

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

Direct Known Subclasses

Bolt, 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



26
27
28
# File 'lib/neo4j/core/cypher_session/transactions.rb', line 26

def after_commit(&block)
  after_commit_registry << block
end

#after_commit_registryObject



22
23
24
# File 'lib/neo4j/core/cypher_session/transactions.rb', line 22

def after_commit_registry
  @after_commit_registry ||= []
end

#post_close!Object



30
31
32
33
# File 'lib/neo4j/core/cypher_session/transactions.rb', line 30

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

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



18
19
20
# File 'lib/neo4j/core/cypher_session/transactions.rb', line 18

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

#query(*args) ⇒ Object



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

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