module Neo4j::Core::CypherSession::Adaptors::Schema

Public Instance Methods

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