Sha256: 57cfedcff556348ff05a5027819f1f74da7dd7b39ca940a32f4262be85ba7fc4

Contents?: true

Size: 1.04 KB

Versions: 57

Compression:

Stored size: 1.04 KB

Contents

module Neo4j
  module Server
    class CypherLabel < Neo4j::Label
      extend Forwardable
      def_delegator :@session, :query_cypher_for
      attr_reader :name

      def initialize(session, name)
        @name = name
        @session = session
      end

      def create_index(property, options = {}, session = Neo4j::Session.current)
        validate_index_options!(options)
        properties = property.is_a?(Array) ? property.join(',') : property
        response = session._query("CREATE INDEX ON :`#{@name}`(#{properties})")
        response.raise_error if response.error?
      end

      def drop_index(property, options = {}, session = Neo4j::Session.current)
        validate_index_options!(options)
        response = session._query("DROP INDEX ON :`#{@name}`(#{property})")
        response.raise_error if response.error? && !response.error_msg.match(/No such INDEX ON/)
      end

      def indexes
        @session.indexes(@name)
      end

      def uniqueness_constraints
        @session.uniqueness_constraints(@name)
      end
    end
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

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