postgres_utility 1.0.0 → 1.0.1

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: 38052dc3eff9df3a9e8f7d5ef610c4f6eb42cdb818db0e38bb54d5a9d9a20f4f
4
- data.tar.gz: 1668a26b111e84f40c71402bbb7377c59dbb6bd721a595ce4aa75a7e40767a6b
3
+ metadata.gz: c2c57bdf515f8eec9ae85b15df2b68fc2a3d33465aa5156898c9b7aec38851c3
4
+ data.tar.gz: 782f4a252779a4f83a61281456a12417780841753cae06fe7aa8b68db829f382
5
5
  SHA512:
6
- metadata.gz: 2563e9201f134f375c51b04f0b347fc3527457c1c91cc142fa8cbd9646de7e26d192919b5707d5265bd53e42af14697ee25d35293a9edcb31e01c601c626412b
7
- data.tar.gz: 783974536590bbab6315b0864eb93d3819bad5caafaa46769db8057bc8480cef69d1b997af57c657f7cdb922ab97086e867955747e46ac606e9ce752cecff3df
6
+ metadata.gz: 453344285b50abf4a4cd2443f20d936442dd3f5965e4876fe380abc59b7c9db48d9fa8e52d46ac8e597d7ff20a87c130f2fe6c9bf33879ae2f57f7fc936d00c8
7
+ data.tar.gz: b211197198cb3057555e73536be19791ca8bdc70176b6c5f6f498814df8f2cb89d47bfb8ebc9f652daca6d4c1ee0b1606921780904c61e0671ee79d19412ef0a
data/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ ## [Unreleased]
2
+
3
+ ## [1.0.0] - 2021-10-04
4
+
5
+ - Initial release
6
+
7
+ ## [1.0.1] - 2021-10-08
8
+
9
+ - use sanitize method instead of sanitize_sql if sanitize_sql is not supported by activerecord
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PostgresUtility
4
- VERSION = '1.0.0'
4
+ VERSION = '1.0.1'
5
5
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative 'postgres_utility/version'
4
+ require 'byebug'
4
5
 
5
6
  # rubocop:disable Layout/LineLength, Metrics/ModuleLength
6
7
 
@@ -456,7 +457,11 @@ module PostgresUtility
456
457
  table = model.table_name
457
458
 
458
459
  value_batches = Array(values.in_groups_of(batch_size).map do |batch|
459
- batch.compact.map { |item| "(#{columns.map { |col| process_value(item[col]) }.join(', ')})" }.join(', ')
460
+ batch.compact.map do |item|
461
+ "(#{columns.map do |col|
462
+ process_value(item[col])
463
+ end.join(', ')})"
464
+ end.join(', ')
460
465
  end)
461
466
 
462
467
  model.transaction do
@@ -494,7 +499,7 @@ module PostgresUtility
494
499
  if value.is_a?(Time)
495
500
  "TIMESTAMP '#{value.strftime('%Y-%m-%d %H:%M:%S')}'"
496
501
  else
497
- ActiveRecord::Base.sanitize_sql(value)
502
+ ActiveRecord::Base.respond_to?(:sanitize_sql) ? ActiveRecord::Base.sanitize_sql(value) : ActiveRecord::Base.sanitize(value)
498
503
  end
499
504
  end
500
505
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postgres_utility
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - sachinsaxena1996
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-04 00:00:00.000000000 Z
11
+ date: 2021-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -106,6 +106,7 @@ files:
106
106
  - ".gitignore"
107
107
  - ".rspec"
108
108
  - ".rubocop.yml"
109
+ - CHANGELOG.md
109
110
  - CODE_OF_CONDUCT.md
110
111
  - Gemfile
111
112
  - Gemfile.lock
@@ -140,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
141
  - !ruby/object:Gem::Version
141
142
  version: '0'
142
143
  requirements: []
143
- rubygems_version: 3.0.3
144
+ rubygems_version: 3.0.8
144
145
  signing_key:
145
146
  specification_version: 4
146
147
  summary: Postgres_utility gem to perform a variety of methods on Rails app having