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 +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/postgres_utility/version.rb +1 -1
- data/lib/postgres_utility.rb +7 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2c57bdf515f8eec9ae85b15df2b68fc2a3d33465aa5156898c9b7aec38851c3
|
4
|
+
data.tar.gz: 782f4a252779a4f83a61281456a12417780841753cae06fe7aa8b68db829f382
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 453344285b50abf4a4cd2443f20d936442dd3f5965e4876fe380abc59b7c9db48d9fa8e52d46ac8e597d7ff20a87c130f2fe6c9bf33879ae2f57f7fc936d00c8
|
7
|
+
data.tar.gz: b211197198cb3057555e73536be19791ca8bdc70176b6c5f6f498814df8f2cb89d47bfb8ebc9f652daca6d4c1ee0b1606921780904c61e0671ee79d19412ef0a
|
data/CHANGELOG.md
ADDED
data/lib/postgres_utility.rb
CHANGED
@@ -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
|
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.
|
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-
|
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.
|
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
|