activecypher 0.14.2 → 0.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/active_cypher/associations/collection_proxy.rb +5 -2
- data/lib/active_cypher/associations.rb +22 -32
- data/lib/active_cypher/base.rb +14 -2
- data/lib/active_cypher/bolt/connection.rb +16 -102
- data/lib/active_cypher/bolt/driver.rb +4 -4
- data/lib/active_cypher/bolt/messaging.rb +32 -104
- data/lib/active_cypher/bolt/packstream.rb +15 -23
- data/lib/active_cypher/connection_adapters/abstract_adapter.rb +17 -1
- data/lib/active_cypher/connection_adapters/abstract_bolt_adapter.rb +21 -23
- data/lib/active_cypher/connection_adapters/memgraph_adapter.rb +4 -24
- data/lib/active_cypher/connection_adapters/neo4j_adapter.rb +0 -24
- data/lib/active_cypher/migration.rb +2 -3
- data/lib/active_cypher/model/connection_owner.rb +1 -2
- data/lib/active_cypher/model/core.rb +8 -0
- data/lib/active_cypher/railtie.rb +2 -2
- data/lib/active_cypher/relation.rb +3 -2
- data/lib/active_cypher/relationship.rb +19 -15
- data/lib/active_cypher/version.rb +1 -1
- data/lib/cyrel/clause/create.rb +1 -5
- data/lib/cyrel/clause/match.rb +1 -7
- data/lib/cyrel/clause/merge.rb +1 -5
- data/lib/cyrel/expression/exists.rb +1 -4
- data/lib/cyrel/expression/pattern_comprehension.rb +1 -4
- data/lib/cyrel/pattern/node.rb +1 -1
- data/lib/cyrel/pattern.rb +10 -0
- data/lib/cyrel/query.rb +63 -117
- data/lib/cyrel.rb +14 -35
- metadata +2 -2
data/lib/cyrel.rb
CHANGED
|
@@ -93,55 +93,34 @@ module Cyrel
|
|
|
93
93
|
# When called like: node(:a) > rel(:r) > node(:b)
|
|
94
94
|
# The rel(:r) is evaluated first, then > is called
|
|
95
95
|
# So we need to modify the last relationship that was just added
|
|
96
|
-
|
|
97
|
-
# Replace the last relationship with one that has the correct direction
|
|
98
|
-
last_rel = @elements.pop
|
|
99
|
-
new_rel = Cyrel::Pattern::Relationship.new(
|
|
100
|
-
alias_name: last_rel.alias_name,
|
|
101
|
-
types: last_rel.types,
|
|
102
|
-
properties: last_rel.properties,
|
|
103
|
-
length: last_rel.length,
|
|
104
|
-
direction: :outgoing
|
|
105
|
-
)
|
|
106
|
-
@elements << new_rel
|
|
107
|
-
else
|
|
108
|
-
@pending_direction = :outgoing
|
|
109
|
-
end
|
|
110
|
-
self
|
|
96
|
+
apply_direction(:outgoing)
|
|
111
97
|
end
|
|
112
98
|
|
|
113
99
|
def <(_other)
|
|
114
100
|
# Same logic as > but for incoming direction
|
|
115
|
-
|
|
116
|
-
last_rel = @elements.pop
|
|
117
|
-
new_rel = Cyrel::Pattern::Relationship.new(
|
|
118
|
-
alias_name: last_rel.alias_name,
|
|
119
|
-
types: last_rel.types,
|
|
120
|
-
properties: last_rel.properties,
|
|
121
|
-
length: last_rel.length,
|
|
122
|
-
direction: :incoming
|
|
123
|
-
)
|
|
124
|
-
@elements << new_rel
|
|
125
|
-
else
|
|
126
|
-
@pending_direction = :incoming
|
|
127
|
-
end
|
|
128
|
-
self
|
|
101
|
+
apply_direction(:incoming)
|
|
129
102
|
end
|
|
130
103
|
|
|
131
104
|
def -(_other)
|
|
132
105
|
# Same logic as > but for bidirectional
|
|
106
|
+
apply_direction(:both)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
private
|
|
110
|
+
|
|
111
|
+
def apply_direction(direction)
|
|
133
112
|
if @elements.last.is_a?(Cyrel::Pattern::Relationship)
|
|
113
|
+
# Replace the last relationship with one that has the correct direction
|
|
134
114
|
last_rel = @elements.pop
|
|
135
|
-
|
|
115
|
+
@elements << Cyrel::Pattern::Relationship.new(
|
|
136
116
|
alias_name: last_rel.alias_name,
|
|
137
117
|
types: last_rel.types,
|
|
138
118
|
properties: last_rel.properties,
|
|
139
119
|
length: last_rel.length,
|
|
140
|
-
direction:
|
|
120
|
+
direction: direction
|
|
141
121
|
)
|
|
142
|
-
@elements << new_rel
|
|
143
122
|
else
|
|
144
|
-
@pending_direction =
|
|
123
|
+
@pending_direction = direction
|
|
145
124
|
end
|
|
146
125
|
self
|
|
147
126
|
end
|
|
@@ -256,9 +235,9 @@ module Cyrel
|
|
|
256
235
|
# Example:
|
|
257
236
|
# Cyrel.exists_block { match(Cyrel.node(:a) > Cyrel.rel(:r) > Cyrel.node(:b, :Admin)) }
|
|
258
237
|
# # => EXISTS { MATCH (a)-[r]->(b:Admin) }
|
|
259
|
-
def exists_block(&
|
|
238
|
+
def exists_block(&)
|
|
260
239
|
subquery = Query.new
|
|
261
|
-
subquery.instance_eval(&
|
|
240
|
+
subquery.instance_eval(&)
|
|
262
241
|
Expression::ExistsBlock.new(subquery)
|
|
263
242
|
end
|
|
264
243
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: activecypher
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.15.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Abdelkader Boudih
|
|
@@ -293,7 +293,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
293
293
|
- !ruby/object:Gem::Version
|
|
294
294
|
version: '0'
|
|
295
295
|
requirements: []
|
|
296
|
-
rubygems_version:
|
|
296
|
+
rubygems_version: 4.0.6
|
|
297
297
|
specification_version: 4
|
|
298
298
|
summary: OpenCypher Adapter ala ActiveRecord
|
|
299
299
|
test_files: []
|