pg_conn 0.47.0 → 0.48.0

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: f44c95a305b34572b5be9025a51b3cff362f08aaf3aa434c4e5b91d0676fb058
4
- data.tar.gz: b8ef0db1095940087e8d08113f76cde7f245ca12a5c56fde5dd9863b85527fe6
3
+ metadata.gz: ac85240194097f71a6470b24774539bb3bbffbdb557aa759cc1b8bf8b1a895d3
4
+ data.tar.gz: 440bbbbc3ef6e0d70fd8139880c15c00b214c40074d0c666e35d589a5bc9ccc0
5
5
  SHA512:
6
- metadata.gz: 80dd909eb3bdb1cdd8100a138c3707dd4a8e23ec975754eb24862464bd8a8013adbd95e455a9b2dd179298740c1bfbbf6b8ad44c33b07e79c95c2c4b81732b41
7
- data.tar.gz: 5224dbafd555d6d05b62f9006aa4a731f9a9e6d434d7c4b8fd39a2a70e99e8ef2db97ef3db3fa5fe3e39c7ecccf032633f134b6845c5e5db58a8077ce9b6a2f2
6
+ metadata.gz: 6e9828f025e235f6bf464d8485898540f13e13d1a55564fdd558f93e4ccc125a494627138fc483e3d3eff27044da3b993baf8df84ede598357f13907020e8ce4
7
+ data.tar.gz: 3630906909fffe1b9d8310a51777307abf587726c24a577ff5777735696927f537de077c0b3ddfdc7e31fd35cd8216a2c37b4c082bdbf34ad683ab21e310dfe1
@@ -1,3 +1,3 @@
1
1
  module PgConn
2
- VERSION = "0.47.0"
2
+ VERSION = "0.48.0"
3
3
  end
data/lib/pg_conn.rb CHANGED
@@ -94,6 +94,12 @@ module PgConn
94
94
  Literal.new values.map { |value| quote_value(value, **opts) }.join(", ")
95
95
  end
96
96
 
97
+ # Quote array as a row - '(value, value, ...)'
98
+ def self.quote_row(row, **opts) = quote_list(row, **opts)
99
+
100
+ # Quote values as a list of rows - '(value, value), (value, value), ...'
101
+ def self.quote_rows(rows, **opts) = rows.map { quote_list(_1, **opts) }.join(', ')
102
+
97
103
  # Quote an array of values as a tuple. The element types should be in the
98
104
  # same order as the array arguments. #quote_tuples is same as #quote_values
99
105
  # except the values may have different types (this makes no difference
@@ -113,7 +119,7 @@ module PgConn
113
119
  Literal.new tuples.map { |tuple| "(#{quote_tuple(tuple, **opts)})" }.join(", ")
114
120
  end
115
121
 
116
- # Quote array elements as a comma separated list of values and enclosed en
122
+ # Quote array elements as a comma separated list of values and enclosed in
117
123
  # parenthesis. Eg. [1, 2] => "(1, 2)"
118
124
  def self.quote_list(array, **opts) = quote_tuples([array], **opts)
119
125
 
@@ -471,6 +477,8 @@ module PgConn
471
477
  def quote_identifiers(idents) = PgConn.quote_identifiers(idents)
472
478
  def quote_value(value, **opts) = PgConn.quote_value(value, json_type: self.default_json_type, **opts)
473
479
  def quote_values(values, **opts) = PgConn.quote_values(values, json_type: self.default_json_type, **opts)
480
+ def quote_row(row, **opts) = PgConn.quote_row(row, json_type: self.default_json_type, **opts)
481
+ def quote_rows(rows, **opts) = PgConn.quote_rows(rows, json_type: self.default_json_type, **opts)
474
482
  def quote_tuple(tuple, **opts) = PgConn.quote_tuple(tuple, json_type: self.default_json_type, **opts)
475
483
  def quote_tuples(tuples, **opts) = PgConn.quote_tuples(tuples, json_type: self.default_json_type, **opts)
476
484
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_conn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.47.0
4
+ version: 0.48.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claus Rasmussen