Sha256: 2ffe338c6b2ad85e9873807b41fc1ebb20c7d7e0a711a7cb2fdaceaa5e6bc02f

Contents?: true

Size: 1.16 KB

Versions: 24

Compression:

Stored size: 1.16 KB

Contents

module Neo4j
  module Core
    class CypherSession
      module Transactions
        class Base < Neo4j::Transaction::Base
          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

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

          def after_commit_registry
            @after_commit_registry ||= []
          end

          def after_commit(&block)
            after_commit_registry << block
          end

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

          private

          # Because we're inheriting from the old Transaction class
          # but the new adaptors work much like the old sessions
          def adaptor
            @session.adaptor
          end
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
neo4j-core-8.1.4 lib/neo4j/core/cypher_session/transactions.rb
neo4j-core-8.1.3 lib/neo4j/core/cypher_session/transactions.rb
neo4j-core-8.1.2 lib/neo4j/core/cypher_session/transactions.rb
neo4j-core-8.1.1 lib/neo4j/core/cypher_session/transactions.rb
neo4j-core-8.1.0 lib/neo4j/core/cypher_session/transactions.rb
neo4j-core-8.0.4 lib/neo4j/core/cypher_session/transactions.rb
neo4j-core-8.0.3 lib/neo4j/core/cypher_session/transactions.rb
neo4j-core-8.0.2 lib/neo4j/core/cypher_session/transactions.rb
neo4j-core-8.0.1 lib/neo4j/core/cypher_session/transactions.rb
neo4j-core-7.2.4 lib/neo4j/core/cypher_session/transactions.rb
neo4j-core-8.0.0 lib/neo4j/core/cypher_session/transactions.rb
neo4j-core-7.2.3 lib/neo4j/core/cypher_session/transactions.rb
neo4j-core-7.2.2 lib/neo4j/core/cypher_session/transactions.rb
neo4j-core-7.2.1 lib/neo4j/core/cypher_session/transactions.rb
neo4j-core-7.2.0 lib/neo4j/core/cypher_session/transactions.rb
neo4j-core-7.1.2 lib/neo4j/core/cypher_session/transactions.rb
neo4j-core-7.0.9 lib/neo4j/core/cypher_session/transactions.rb
neo4j-core-7.1.1 lib/neo4j/core/cypher_session/transactions.rb
neo4j-core-7.1.0 lib/neo4j/core/cypher_session/transactions.rb
neo4j-core-7.0.8 lib/neo4j/core/cypher_session/transactions.rb