Sha256: 2c42edbb9cc9a7581f1ef4cb34ad7fd69f71777e035d6b177d536f2cd139514d

Contents?: true

Size: 815 Bytes

Versions: 9

Compression:

Stored size: 815 Bytes

Contents

module Neo4j
  module Core
    class QueryBuilder
      attr_reader :queries

      Query = Struct.new(:cypher, :parameters, :pretty_cypher, :context)

      def initialize
        @queries = []
      end

      def append(*args)
        query = case args.map(&:class)
                when [String], [String, Hash]
                  Query.new(args[0], args[1] || {})
                when [::Neo4j::Core::Query]
                  args[0]
                else
                  fail ArgumentError, "Could not determine query from arguments: #{args.inspect}"
                end

        @queries << query
      end

      def query
        # `nil` sessions are just a workaround until
        # we phase out `Query` objects containing sessions
        Neo4j::Core::Query.new(session: nil)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
activegraph-10.0.0.pre.alpha.9 lib/neo4j/core/query_builder.rb
activegraph-10.0.0.pre.alpha.8 lib/neo4j/core/query_builder.rb
activegraph-10.0.0.pre.alpha.7 lib/neo4j/core/query_builder.rb
activegraph-10.0.0.pre.alpha.6 lib/neo4j/core/query_builder.rb
neo4j-10.0.0.pre.alpha.5 lib/neo4j/core/query_builder.rb
neo4j-10.0.0.pre.alpha.4 lib/neo4j/core/query_builder.rb
neo4j-10.0.0.pre.alpha.3 lib/neo4j/core/query_builder.rb
neo4j-10.0.0.pre.alpha.2 lib/neo4j/core/query_builder.rb
neo4j-10.0.0.pre.alpha.1 lib/neo4j/core/query_builder.rb