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-7.0.7 lib/neo4j-server/cypher_label.rb
neo4j-core-7.0.6 lib/neo4j-server/cypher_label.rb
neo4j-core-7.0.5 lib/neo4j-server/cypher_label.rb
neo4j-core-7.0.4 lib/neo4j-server/cypher_label.rb
neo4j-core-7.0.3 lib/neo4j-server/cypher_label.rb
neo4j-core-7.0.2 lib/neo4j-server/cypher_label.rb
neo4j-core-7.0.1 lib/neo4j-server/cypher_label.rb
neo4j-core-7.0.0 lib/neo4j-server/cypher_label.rb
neo4j-core-6.1.6 lib/neo4j-server/cypher_label.rb
neo4j-core-7.0.0.rc.2 lib/neo4j-server/cypher_label.rb
neo4j-core-7.0.0.rc.1 lib/neo4j-server/cypher_label.rb
neo4j-core-7.0.0.alpha.8 lib/neo4j-server/cypher_label.rb
neo4j-core-7.0.0.alpha.7 lib/neo4j-server/cypher_label.rb
neo4j-core-6.1.5 lib/neo4j-server/cypher_label.rb
neo4j-core-7.0.0.alpha.6 lib/neo4j-server/cypher_label.rb
neo4j-core-7.0.0.alpha.5 lib/neo4j-server/cypher_label.rb
neo4j-core-7.0.0.alpha.4 lib/neo4j-server/cypher_label.rb
neo4j-core-7.0.0.alpha.3 lib/neo4j-server/cypher_label.rb
neo4j-core-7.0.0.alpha.2 lib/neo4j-server/cypher_label.rb
neo4j-core-7.0.0.alpha.1 lib/neo4j-server/cypher_label.rb