activegraph-extensions 0.0.3-java → 0.0.4-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fbb2be9a5d8f1afc55b3888e1afc33940a2eb709de5afae7144f25992d2d0873
4
- data.tar.gz: 23a259b8d2dffd7e6f73e552275fe0d9b9849bfcb80bc437be21c6e32944d5fe
3
+ metadata.gz: 822c83b14e7ebc57f5b13232de171a80a1b954d1c1777853e73299950ddf94b8
4
+ data.tar.gz: 5dd31ca0ddf3cec93e366cab32fc026565045ce8d24680ff2aff10f4df24b4cb
5
5
  SHA512:
6
- metadata.gz: 55a7e0e10065e825acef207348a9277162af5d6ec81b158b957b266e37ba0fa98c6aa620cca84a31b253a58574880742a13d7f7f7cda576fd1f7dab3e60eda15
7
- data.tar.gz: 679aa1b9d1ad94633506b1938cb3d50ea3bd2af2bd9392f352370f5d4410476cabf1a327bae1d6cafdbd18f5b62650b94584c826ea65cb4bb61be1a035eaa57a
6
+ metadata.gz: 58f75afdac57dfe835551242707ba89d248de6f073052e0fb08edb4010e30f24d9f383613ff3c1aa46117a5b35448b5663914971e89cf2b3bb24b2763c3669b2
7
+ data.tar.gz: 9062f2a9c43e2da8b42178c36c6dba95a0b3946a94afbdc56908cd49673548864024e7885becffa6d8686a8798d2333a7d7d3ef858e179291335f35a80502533
@@ -6,25 +6,28 @@ module ActiveGraphExtensions
6
6
  module QueryProxyEagerLoading
7
7
  module AssociationLimiting
8
8
  def self.included(base)
9
- base.attr_reader(:default_assoc_limit)
9
+ base.attr_reader(:max_page_size)
10
+ base.attr_reader(:paginate)
10
11
  end
11
12
 
12
13
  private
13
14
 
14
15
  def rel_collection_str(path)
15
- limit = association_limit(path)
16
16
  collection_name = "[#{relationship_name(path)}, #{escape(path_name(path))}] "
17
- collection = limit.present? ? "apoc.agg.slice(#{collection_name}, 0, #{limit})" : "collect(#{collection_name})"
17
+ collection = apply_limit?(path) ? "apoc.agg.slice(#{collection_name}, 0, #{association_limit(path)})" : "collect(#{collection_name})"
18
18
  "#{collection} AS #{escape("#{path_name(path)}_collection")}"
19
19
  end
20
20
 
21
- def relationship_name(path)
22
- if path.last.rel_length
23
- "last(relationships(#{escape("#{path_name(path)}_path")}))"
24
- else
25
- escape("#{path_name(path)}_rel")
21
+ def apply_limit?(path)
22
+ !multipath?(path) && (path.last&.association_limit || paginate)
26
23
  end
27
24
 
25
+ def relationship_name(path)
26
+ if path.last.rel_length
27
+ "last(relationships(#{escape("#{path_name(path)}_path")}))"
28
+ else
29
+ escape("#{path_name(path)}_rel")
30
+ end
28
31
  end
29
32
 
30
33
  def convert_to_list(collection_name, limit)
@@ -32,10 +35,8 @@ module ActiveGraphExtensions
32
35
  end
33
36
 
34
37
  def association_limit(path)
35
- return if multipath?(path)
36
-
37
38
  limit = path.last&.association_limit
38
- limit.blank? || limit.to_i > default_assoc_limit ? default_assoc_limit : limit
39
+ limit.blank? || limit.to_i > max_page_size ? max_page_size : limit
39
40
  end
40
41
 
41
42
  def with_association_query_part(base_query, path, previous_with_vars)
@@ -12,7 +12,8 @@ module ActiveGraphExtensions
12
12
  end
13
13
 
14
14
  def with_ordered_associations(spec, order, opts = {})
15
- @default_assoc_limit = opts[:default_assoc_limit]
15
+ @max_page_size = opts[:max_page_size]
16
+ @paginate = opts[:paginate]
16
17
  @with_vars = opts[:with_vars]
17
18
  @order_spec = order.with_indifferent_access unless spec.empty?
18
19
  @opts = opts
@@ -1,3 +1,3 @@
1
1
  module ActiveGraphExtensions
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activegraph-extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: java
6
6
  authors:
7
7
  - Amit Suryavanshi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-23 00:00:00.000000000 Z
11
+ date: 2023-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -17,8 +17,8 @@ dependencies:
17
17
  - !ruby/object:Gem::Version
18
18
  version: '0'
19
19
  name: parslet
20
- type: :runtime
21
20
  prerelease: false
21
+ type: :runtime
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
@@ -31,8 +31,8 @@ dependencies:
31
31
  - !ruby/object:Gem::Version
32
32
  version: '0'
33
33
  name: activegraph
34
- type: :runtime
35
34
  prerelease: false
35
+ type: :runtime
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
@@ -45,8 +45,8 @@ dependencies:
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
47
  name: guard
48
- type: :development
49
48
  prerelease: false
49
+ type: :development
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
@@ -59,8 +59,8 @@ dependencies:
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
61
  name: guard-rspec
62
- type: :development
63
62
  prerelease: false
63
+ type: :development
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
@@ -73,8 +73,8 @@ dependencies:
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
75
  name: guard-rubocop
76
- type: :development
77
76
  prerelease: false
77
+ type: :development
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
@@ -87,8 +87,8 @@ dependencies:
87
87
  - !ruby/object:Gem::Version
88
88
  version: 0.3.0
89
89
  name: neo4j-rake_tasks
90
- type: :development
91
90
  prerelease: false
91
+ type: :development
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ">="
@@ -101,8 +101,8 @@ dependencies:
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
103
  name: os
104
- type: :development
105
104
  prerelease: false
105
+ type: :development
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - ">="
@@ -115,8 +115,8 @@ dependencies:
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0'
117
117
  name: pry
118
- type: :development
119
118
  prerelease: false
119
+ type: :development
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - ">="
@@ -129,8 +129,8 @@ dependencies:
129
129
  - !ruby/object:Gem::Version
130
130
  version: '4.0'
131
131
  name: railties
132
- type: :development
133
132
  prerelease: false
133
+ type: :development
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - ">="
@@ -143,8 +143,8 @@ dependencies:
143
143
  - !ruby/object:Gem::Version
144
144
  version: '0'
145
145
  name: rake
146
- type: :development
147
146
  prerelease: false
147
+ type: :development
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - ">="
@@ -157,8 +157,8 @@ dependencies:
157
157
  - !ruby/object:Gem::Version
158
158
  version: 0.56.0
159
159
  name: rubocop
160
- type: :development
161
160
  prerelease: false
161
+ type: :development
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - ">="
@@ -171,8 +171,8 @@ dependencies:
171
171
  - !ruby/object:Gem::Version
172
172
  version: '0'
173
173
  name: yard
174
- type: :development
175
174
  prerelease: false
175
+ type: :development
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - ">="
@@ -185,8 +185,8 @@ dependencies:
185
185
  - !ruby/object:Gem::Version
186
186
  version: '0'
187
187
  name: dryspec
188
- type: :development
189
188
  prerelease: false
189
+ type: :development
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - ">="
@@ -199,8 +199,8 @@ dependencies:
199
199
  - !ruby/object:Gem::Version
200
200
  version: '3.10'
201
201
  name: rspec
202
- type: :development
203
202
  prerelease: false
203
+ type: :development
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - "<"
@@ -255,7 +255,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
255
255
  - !ruby/object:Gem::Version
256
256
  version: '0'
257
257
  requirements: []
258
- rubygems_version: 3.0.6
258
+ rubygems_version: 3.2.29
259
259
  signing_key:
260
260
  specification_version: 4
261
261
  summary: Additional features to activegraph