Module: Neo4j::Core::CypherSession::Adaptors::Schema
Instance Method Summary collapse
Instance Method Details
#constraints(session) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/neo4j/core/cypher_session/adaptors/schema.rb', line 22 def constraints(session) result = query(session, 'CALL db.indexes()', {}, skip_instrumentation: true) result.select { |row| row.type == 'node_unique_property' }.map do |row| label, property = row.description.match(/INDEX ON :([^\(]+)\(([^\)]+)\)/)[1, 2] {type: :uniqueness, label: label.to_sym, properties: [property.to_sym]} end end |
#indexes(session) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/neo4j/core/cypher_session/adaptors/schema.rb', line 13 def indexes(session) result = query(session, 'CALL db.indexes()', {}, skip_instrumentation: true) result.map do |row| label, property = row.description.match(/INDEX ON :([^\(]+)\(([^\)]+)\)/)[1, 2] {type: row.type.to_sym, label: label.to_sym, properties: [property.to_sym], state: row.state.to_sym} end end |
#version(session) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/neo4j/core/cypher_session/adaptors/schema.rb', line 6 def version(session) result = query(session, 'CALL dbms.components()', {}, skip_instrumentation: true) # BTW: community / enterprise could be retrieved via `result.first.edition` result.first.versions[0] end |