Class: Neo4j::Core::CypherSession::Adaptors::Base

Inherits:
Object
  • Object
show all
Includes:
Instrumentable
Defined in:
lib/neo4j/core/cypher_session/adaptors.rb

Direct Known Subclasses

Embedded, HTTP

Defined Under Namespace

Classes: Query, QueryBuilder

Constant Summary collapse

EMPTY =
''
NEWLINE_W_SPACES =
"\n  "

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Instrumentable

included

Class Method Details

.instrument_queries(queries) ⇒ Object



111
112
113
114
115
# File 'lib/neo4j/core/cypher_session/adaptors.rb', line 111

def instrument_queries(queries)
  queries.each do |query|
    instrument_query(query) {}
  end
end

Instance Method Details

#connect(*_args) ⇒ Object



13
14
15
# File 'lib/neo4j/core/cypher_session/adaptors.rb', line 13

def connect(*_args)
  fail '#connect not implemented!'
end

#end_transaction(*_args) ⇒ Object



66
67
68
# File 'lib/neo4j/core/cypher_session/adaptors.rb', line 66

def end_transaction(*_args)
  fail '#end_transaction not implemented!'
end

#indexes_for_label(*_args) ⇒ Object

Schema inspection methods



79
80
81
# File 'lib/neo4j/core/cypher_session/adaptors.rb', line 79

def indexes_for_label(*_args)
  fail '#indexes_for_label not implemented!'
end

#queries(&block) ⇒ Object



50
51
52
53
54
55
56
# File 'lib/neo4j/core/cypher_session/adaptors.rb', line 50

def queries(&block)
  query_builder = QueryBuilder.new

  query_builder.instance_eval(&block)

  query_set(query_builder.queries)
end

#query(*args) ⇒ Object



46
47
48
# File 'lib/neo4j/core/cypher_session/adaptors.rb', line 46

def query(*args)
  queries { append(*args) }[0]
end

#query_set(_queries) ⇒ Object



58
59
60
# File 'lib/neo4j/core/cypher_session/adaptors.rb', line 58

def query_set(_queries)
  fail '#queries not implemented!'
end

#start_transaction(*_args) ⇒ Object



62
63
64
# File 'lib/neo4j/core/cypher_session/adaptors.rb', line 62

def start_transaction(*_args)
  fail '#start_transaction not implemented!'
end

#transactionObject

Uses #start_transaction and #end_transaction to allow execution of queries within a block to be part of a full transaction



91
92
93
94
95
96
97
# File 'lib/neo4j/core/cypher_session/adaptors.rb', line 91

def transaction
  start_transaction

  yield
ensure
  end_transaction if transaction_started?
end

#transaction_started?(*_args) ⇒ Boolean

Returns:

  • (Boolean)


70
71
72
# File 'lib/neo4j/core/cypher_session/adaptors.rb', line 70

def transaction_started?(*_args)
  fail '#transaction_started? not implemented!'
end

#uniqueness_constraints_for_label(*_args) ⇒ Object



83
84
85
# File 'lib/neo4j/core/cypher_session/adaptors.rb', line 83

def uniqueness_constraints_for_label(*_args)
  fail '#uniqueness_constraints_for_label not implemented!'
end

#version(*_args) ⇒ Object



74
75
76
# File 'lib/neo4j/core/cypher_session/adaptors.rb', line 74

def version(*_args)
  fail '#version not implemented!'
end