query_helper 0.2.30 → 0.3.5

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
  SHA256:
3
- metadata.gz: 03de8ed1f4ad37b3fd8eb07edfedd5829c06e3502e78450fcbea037841a55bd7
4
- data.tar.gz: 79598bdaca7ee9073f90858c906a5492c6eec8e4e6e514ddaa8397d0cf0afcc1
3
+ metadata.gz: 216dd6ebcc3d4be6014068002ae576a58bb0ec6a040fea677c1b34cd179d2d0e
4
+ data.tar.gz: 445170ef612bcfa6342bcd3c0be20d29067d672e038e85b50832cea83322c008
5
5
  SHA512:
6
- metadata.gz: 75cf73dd094f480095b4d0e2b8d9ae941d54a817e172dcbc3ddcc270f5c97e8c64e8303d5df8b3b0d876cb3ae5c230426920f329659892574db5889cb0ab1cd4
7
- data.tar.gz: 25e7609715272868b5f6baf61a229d704b21cbc97f6a71be5a28126f763f9472088bc396498d60208492a2b582ac17d1994bbd2e8293c685b423c199da864e31
6
+ metadata.gz: 8d412f5a205b9120b3a67a337cf67e829f89f9b9729ede92728c13e5de9fc98afbde03db42d1c23a7ada03027d208f24bfa3725a4e6ec1a21900900717370c6c
7
+ data.tar.gz: 8df8fbe91ceb8585b0dcd5b50a32e9a26bfdbb1784451c8e4e1f3f2e3f909112b8ecfd2ea97b0a7619ee19fc225144ab086f6ca09983c612336f035810488474
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- query_helper (0.2.30)
4
+ query_helper (0.3.5)
5
5
  activerecord (> 5)
6
6
  activesupport (> 5)
7
7
  sqlite3
@@ -43,13 +43,13 @@ GEM
43
43
  i18n (>= 0.7)
44
44
  i18n (1.8.10)
45
45
  concurrent-ruby (~> 1.0)
46
- loofah (2.12.0)
46
+ loofah (2.18.0)
47
47
  crass (~> 1.0.2)
48
48
  nokogiri (>= 1.5.9)
49
49
  method_source (1.0.0)
50
50
  mini_portile2 (2.8.0)
51
51
  minitest (5.14.4)
52
- nokogiri (1.13.3)
52
+ nokogiri (1.13.8)
53
53
  mini_portile2 (~> 2.8.0)
54
54
  racc (~> 1.4)
55
55
  racc (1.6.0)
@@ -59,7 +59,7 @@ GEM
59
59
  rails-dom-testing (2.0.3)
60
60
  activesupport (>= 4.2.0)
61
61
  nokogiri (>= 1.6)
62
- rails-html-sanitizer (1.4.2)
62
+ rails-html-sanitizer (1.4.3)
63
63
  loofah (~> 2.3)
64
64
  railties (6.1.4.1)
65
65
  actionpack (= 6.1.4.1)
@@ -89,7 +89,8 @@ GEM
89
89
  rspec-mocks (~> 3.10)
90
90
  rspec-support (~> 3.10)
91
91
  rspec-support (3.10.2)
92
- sqlite3 (1.4.2)
92
+ sqlite3 (1.6.2)
93
+ mini_portile2 (~> 2.8.0)
93
94
  thor (1.1.0)
94
95
  tzinfo (2.0.4)
95
96
  concurrent-ruby (~> 1.0)
@@ -8,12 +8,24 @@ class QueryHelper
8
8
  def self.load_associations(payload:, associations: [], as_json_options: {})
9
9
  as_json_options ||= {}
10
10
  as_json_options[:include] = as_json_options[:include] || json_associations(associations)
11
- ActiveRecord::Associations::Preloader.new.preload(payload, associations)
11
+ begin
12
+ # Preloader have been changed in Rails 7, which is giving error on upgrade.
13
+ # This should be updated to latest API once all repos have been upgraded to Rails 7
14
+ ActiveRecord::Associations::Preloader.new.preload(payload, associations)
15
+ rescue
16
+ ActiveRecord::Associations::Preloader.new(records: payload, associations: associations).call
17
+ end
12
18
  payload.as_json(as_json_options)
13
19
  end
14
20
 
15
21
  def self.preload_associations(payload:, preload: [])
16
- ActiveRecord::Associations::Preloader.new.preload(payload, preload)
22
+ begin
23
+ # Preloader have been changed in Rails 7, which is giving error on upgrade.
24
+ # This should be updated to latest API once all repos have been upgraded to Rails 7
25
+ ActiveRecord::Associations::Preloader.new.preload(payload, preload)
26
+ rescue
27
+ ActiveRecord::Associations::Preloader.new(records: payload, associations: preload).call
28
+ end
17
29
  end
18
30
 
19
31
  def self.json_associations(associations)
@@ -26,8 +26,8 @@ class QueryHelper
26
26
  end
27
27
 
28
28
  def build
29
- insert_having_clauses()
30
29
  insert_qualify_clauses()
30
+ insert_having_clauses()
31
31
  insert_where_clauses()
32
32
  insert_select_clauses()
33
33
  insert_order_by_and_limit_clause()
@@ -49,7 +49,7 @@ class QueryHelper
49
49
 
50
50
  def qualify_clauses(index)
51
51
  if index == 0
52
- "qualified_results AS ( "
52
+ "WITH qualified_results AS ( "
53
53
  else
54
54
  ", qualified_results AS ( "
55
55
  end
@@ -114,7 +114,7 @@ class QueryHelper
114
114
  end
115
115
 
116
116
  def insert_where_index
117
- group_by_index() || order_by_index() || limit_index() || @sql.length
117
+ qualify_index() || group_by_index() || order_by_index() || limit_index() || @sql.length
118
118
  end
119
119
 
120
120
  def insert_qualify_index
@@ -1,3 +1,3 @@
1
1
  class QueryHelper
2
- VERSION = "0.2.30"
2
+ VERSION = "0.3.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: query_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.30
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patterninc
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-24 00:00:00.000000000 Z
11
+ date: 2023-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -201,7 +201,7 @@ homepage: https://github.com/patterninc/query_helper
201
201
  licenses:
202
202
  - MIT
203
203
  metadata: {}
204
- post_install_message:
204
+ post_install_message:
205
205
  rdoc_options: []
206
206
  require_paths:
207
207
  - lib
@@ -216,8 +216,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
216
216
  - !ruby/object:Gem::Version
217
217
  version: '0'
218
218
  requirements: []
219
- rubygems_version: 3.1.4
220
- signing_key:
219
+ rubygems_version: 3.4.10
220
+ signing_key:
221
221
  specification_version: 4
222
222
  summary: Ruby Gem to help with pagination and data formatting at Pattern, Inc.
223
223
  test_files: []