Class: Neo4j::Server::CypherLabel
- Extended by:
- Forwardable
- Defined in:
- lib/neo4j-server/cypher_label.rb
Constant Summary
Constants inherited from Label
Label::CONSTRAINT_PATH, Label::INDEX_PATH
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #create_index(*properties) ⇒ Object
- #drop_index(*properties) ⇒ Object
- #indexes ⇒ Object
-
#initialize(session, name) ⇒ CypherLabel
constructor
A new instance of CypherLabel.
- #uniqueness_constraints ⇒ Object
Methods inherited from Label
constraint?, constraints, create, #create_constraint, drop_all_constraints, drop_all_indexes, #drop_constraint, find_all_nodes, find_nodes, index?, indexes
Constructor Details
#initialize(session, name) ⇒ CypherLabel
Returns a new instance of CypherLabel.
8 9 10 11 |
# File 'lib/neo4j-server/cypher_label.rb', line 8 def initialize(session, name) @name = name @session = session end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/neo4j-server/cypher_label.rb', line 6 def name @name end |
Instance Method Details
#create_index(*properties) ⇒ Object
13 14 15 16 |
# File 'lib/neo4j-server/cypher_label.rb', line 13 def create_index(*properties) response = @session._query("CREATE INDEX ON :`#{@name}`(#{properties.join(',')})") response.raise_error if response.error? end |
#drop_index(*properties) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/neo4j-server/cypher_label.rb', line 18 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 |
#indexes ⇒ Object
25 26 27 |
# File 'lib/neo4j-server/cypher_label.rb', line 25 def indexes @session.indexes(@name) end |
#uniqueness_constraints ⇒ Object
29 30 31 |
# File 'lib/neo4j-server/cypher_label.rb', line 29 def uniqueness_constraints @session.uniqueness_constraints(@name) end |