neo4j 7.0.0.rc.6 → 7.0.0.rc.7
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/CHANGELOG.md +6 -0
- data/lib/neo4j/active_node/query/query_proxy_eager_loading.rb +18 -11
- data/lib/neo4j/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b10c83437aa0b328f4c1b1225c221bbf1708542d
|
4
|
+
data.tar.gz: 3d736b7c8d204283ff6022d4e5c278d84c0816f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef03d301843b8c5b2ffb24ae17045460b799270726d1607c5c972fa1c43d9bb978aa4e1dd1add2a1cbc3d95a2d9047a8133956c8140a8e0d92ee2af9b92169f4
|
7
|
+
data.tar.gz: 88adea936e7e9753d0b3dd8359d87589a85e803275c0fc879fda0ee95f88e8a320dc2ec01633ce15796f50a11611bb0907fb2f15acb5edcd3887e39d96310fbe
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file.
|
|
3
3
|
This file should follow the standards specified on [http://keepachangelog.com/]
|
4
4
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
5
5
|
|
6
|
+
## [7.0.0.rc.7] - 03-16-2016
|
7
|
+
|
8
|
+
### Changed
|
9
|
+
|
10
|
+
- `with_associations` now generates separate `OPTIONAL MATCH` clauses, separated by `WITH` clauses and is preceeded by a `WITH` clause.
|
11
|
+
|
6
12
|
## [7.0.0.rc.6] - 03-16-2016
|
7
13
|
|
8
14
|
### Fixed
|
@@ -5,7 +5,7 @@ module Neo4j
|
|
5
5
|
def each(node = true, rel = nil, &block)
|
6
6
|
return super if with_associations_spec.size.zero?
|
7
7
|
|
8
|
-
query_from_association_spec.pluck(identity, with_associations_return_clause).map do |record, eager_data|
|
8
|
+
query_from_association_spec.pluck(identity, "[#{with_associations_return_clause}]").map do |record, eager_data|
|
9
9
|
eager_data.each_with_index do |eager_records, index|
|
10
10
|
record.association_proxy(with_associations_spec[index]).cache_result(eager_records)
|
11
11
|
end
|
@@ -18,10 +18,6 @@ module Neo4j
|
|
18
18
|
@with_associations_spec ||= []
|
19
19
|
end
|
20
20
|
|
21
|
-
def with_associations_return_clause
|
22
|
-
'[' + with_associations_spec.map { |n| "collect(#{n})" }.join(',') + ']'
|
23
|
-
end
|
24
|
-
|
25
21
|
def with_associations(*spec)
|
26
22
|
invalid_association_names = spec.reject do |association_name|
|
27
23
|
model.associations[association_name]
|
@@ -39,14 +35,25 @@ module Neo4j
|
|
39
35
|
|
40
36
|
private
|
41
37
|
|
38
|
+
def with_associations_return_clause(variables = with_associations_spec)
|
39
|
+
variables.map { |n| "#{n}_collection" }.join(',')
|
40
|
+
end
|
41
|
+
|
42
42
|
def query_from_association_spec
|
43
|
-
|
44
|
-
|
43
|
+
previous_with_variables = []
|
44
|
+
with_associations_spec.inject(query_as(identity).with(identity)) do |query, association_name|
|
45
|
+
with_association_query_part(query, association_name, previous_with_variables).tap do
|
46
|
+
previous_with_variables << association_name
|
47
|
+
end
|
48
|
+
end.return(identity)
|
49
|
+
end
|
45
50
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
51
|
+
def with_association_query_part(base_query, association_name, previous_with_variables)
|
52
|
+
association = model.associations[association_name]
|
53
|
+
|
54
|
+
base_query.optional_match("#{identity}#{association.arrow_cypher}#{association_name}")
|
55
|
+
.where(association.target_where_clause)
|
56
|
+
.with(identity, "collect(#{association_name}) AS #{association_name}_collection", *with_associations_return_clause(previous_with_variables))
|
50
57
|
end
|
51
58
|
end
|
52
59
|
end
|
data/lib/neo4j/version.rb
CHANGED