Sha256: fe7d06d80aa899150948e80358e5f618a92b62a92520735b1543855b2016b4f8

Contents?: true

Size: 824 Bytes

Versions: 12

Compression:

Stored size: 824 Bytes

Contents

module Neo4j::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

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
neo4j-core-3.1.1 lib/neo4j-server/cypher_label.rb
neo4j-core-3.1.0 lib/neo4j-server/cypher_label.rb
neo4j-core-3.0.8 lib/neo4j-server/cypher_label.rb
neo4j-core-3.0.7 lib/neo4j-server/cypher_label.rb
neo4j-core-3.0.6 lib/neo4j-server/cypher_label.rb
neo4j-core-3.0.5 lib/neo4j-server/cypher_label.rb
neo4j-core-3.0.4 lib/neo4j-server/cypher_label.rb
neo4j-core-3.0.3 lib/neo4j-server/cypher_label.rb
neo4j-core-3.0.2 lib/neo4j-server/cypher_label.rb
neo4j-core-3.0.1 lib/neo4j-server/cypher_label.rb
neo4j-core-3.0.0 lib/neo4j-server/cypher_label.rb
neo4j-core-3.0.0.rc.5 lib/neo4j-server/cypher_label.rb