Module: ActiveGraph::Core::Schema
- Included in:
- Base
- Defined in:
- lib/active_graph/core/schema.rb
Instance Method Summary collapse
- #constraints ⇒ Object
- #indexes ⇒ Object
- #raw_indexes {|result.keys, result.reject { |row| row[:type] == 'LOOKUP' }| ... } ⇒ Object
- #version ⇒ Object
Instance Method Details
#constraints ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/active_graph/core/schema.rb', line 18 def constraints raw_indexes do |keys, result| result.select(&method(v4?(keys) ? :v4_filter : :v3_filter)).map do |row| { type: :uniqueness, label: label(keys, row), properties: properties(row) } end end end |
#indexes ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/active_graph/core/schema.rb', line 9 def indexes raw_indexes do |keys, result| result.map do |row| { type: row[:type].to_sym, label: label(keys, row), properties: properties(row), state: row[:state].to_sym } end end end |
#raw_indexes {|result.keys, result.reject { |row| row[:type] == 'LOOKUP' }| ... } ⇒ Object
26 27 28 29 |
# File 'lib/active_graph/core/schema.rb', line 26 def raw_indexes result = query('CALL db.indexes()', {}, skip_instrumentation: true) yield result.keys, result.reject { |row| row[:type] == 'LOOKUP' } end |
#version ⇒ Object
4 5 6 7 |
# File 'lib/active_graph/core/schema.rb', line 4 def version # BTW: community / enterprise could be retrieved via `result.first.edition` query('CALL dbms.components()', {}, skip_instrumentation: true).first[:versions][0] end |