Sha256: a5dadc4575850eabcdd7f41285aab8d2cee007646e9aaf7288c84290bb28c2c4

Contents?: true

Size: 812 Bytes

Versions: 2

Compression:

Stored size: 812 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` drivers are just a workaround until
        # we phase out `Query` objects containing drivers
        Neo4j::Core::Query.new(driver: nil)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activegraph-10.0.0.pre.alpha.11 lib/neo4j/core/query_builder.rb
activegraph-10.0.0.pre.alpha.10 lib/neo4j/core/query_builder.rb