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(property, options = {}, session = Neo4j::Session.current) ⇒ Object
- #drop_index(property, options = {}, session = Neo4j::Session.current) ⇒ 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(property, options = {}, session = Neo4j::Session.current) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/neo4j-server/cypher_label.rb', line 13 def create_index(property, = {}, session = Neo4j::Session.current) () properties = property.is_a?(Array) ? property.join(',') : property response = session._query("CREATE INDEX ON :`#{@name}`(#{properties})") response.raise_error if response.error? end |
#drop_index(property, options = {}, session = Neo4j::Session.current) ⇒ Object
20 21 22 23 24 |
# File 'lib/neo4j-server/cypher_label.rb', line 20 def drop_index(property, = {}, session = Neo4j::Session.current) () response = session._query("DROP INDEX ON :`#{@name}`(#{property})") response.raise_error if response.error? && !response.error_msg.match(/No such INDEX ON/) end |
#indexes ⇒ Object
26 27 28 |
# File 'lib/neo4j-server/cypher_label.rb', line 26 def indexes @session.indexes(@name) end |
#uniqueness_constraints ⇒ Object
30 31 32 |
# File 'lib/neo4j-server/cypher_label.rb', line 30 def uniqueness_constraints @session.uniqueness_constraints(@name) end |