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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1cddb781f1fdcc684ca92808958afcb02506302a
4
- data.tar.gz: 283f943c9708733cdac212060529483bb87599b8
3
+ metadata.gz: b10c83437aa0b328f4c1b1225c221bbf1708542d
4
+ data.tar.gz: 3d736b7c8d204283ff6022d4e5c278d84c0816f3
5
5
  SHA512:
6
- metadata.gz: 41051a819c7c55326056871a4321784355216f0c9e4a0da3ef9930e37831897b3be4c2d5625bc410a3c64f363fecb67b607d352341a6ae66fb5dc0536d8216ea
7
- data.tar.gz: a33e5e895fba829e67f7174a75e16683c2f2257de5328da2bee89818cf007ad05bba7fa235ea10f9a0985eaa8795eb640d43fa6326d83dd32ed56eef4b0e1516
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
- with_associations_spec.inject(query_as(identity).return(identity)) do |query, association_name|
44
- association = model.associations[association_name]
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
- query.optional_match("#{identity}#{association.arrow_cypher}#{association_name}")
47
- .where(association.target_where_clause)
48
- .break
49
- end
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
@@ -1,3 +1,3 @@
1
1
  module Neo4j
2
- VERSION = '7.0.0.rc.6'
2
+ VERSION = '7.0.0.rc.7'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neo4j
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.0.rc.6
4
+ version: 7.0.0.rc.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Ronge, Brian Underwood, Chris Grigg