Sha256: 489e4e70b323ec73c33b0012fea6d8a7e6095111f2f4b91b947cce8d3022cb97

Contents?: true

Size: 888 Bytes

Versions: 38

Compression:

Stored size: 888 Bytes

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(*properties)
        response = @session._query("CREATE INDEX ON :`#{@name}`(#{properties.join(',')})")
        response.raise_error if response.error?
      end

      def drop_index(*properties)
        properties.each do |property|
          response = @session._query("DROP INDEX ON :`#{@name}`(#{property})")
          response.raise_error if response.error? && !response.error_msg.match(/No such INDEX ON/)
        end
      end

      def indexes
        @session.indexes(@name)
      end

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

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
neo4j-core-5.1.14 lib/neo4j-server/cypher_label.rb
neo4j-core-5.1.12 lib/neo4j-server/cypher_label.rb
neo4j-core-5.1.11 lib/neo4j-server/cypher_label.rb
neo4j-core-5.1.10 lib/neo4j-server/cypher_label.rb
neo4j-core-5.1.7 lib/neo4j-server/cypher_label.rb
neo4j-core-5.1.6 lib/neo4j-server/cypher_label.rb
neo4j-core-5.1.5 lib/neo4j-server/cypher_label.rb
neo4j-core-5.1.4 lib/neo4j-server/cypher_label.rb
neo4j-core-5.1.3 lib/neo4j-server/cypher_label.rb
neo4j-core-5.1.2 lib/neo4j-server/cypher_label.rb
neo4j-core-5.1.1 lib/neo4j-server/cypher_label.rb
neo4j-core-5.1.0 lib/neo4j-server/cypher_label.rb
neo4j-core-5.1.0.rc.3 lib/neo4j-server/cypher_label.rb
neo4j-core-5.1.0.rc.2 lib/neo4j-server/cypher_label.rb
neo4j-core-5.1.0.rc.1 lib/neo4j-server/cypher_label.rb
neo4j-core-5.0.10 lib/neo4j-server/cypher_label.rb
neo4j-core-5.0.9 lib/neo4j-server/cypher_label.rb
neo4j-core-5.0.8 lib/neo4j-server/cypher_label.rb
neo4j-core-5.0.7 lib/neo4j-server/cypher_label.rb
neo4j-core-5.0.6 lib/neo4j-server/cypher_label.rb