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 +4 -4
- data/lib/pg_conn/version.rb +1 -1
- data/lib/pg_conn.rb +9 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ac85240194097f71a6470b24774539bb3bbffbdb557aa759cc1b8bf8b1a895d3
|
|
4
|
+
data.tar.gz: 440bbbbc3ef6e0d70fd8139880c15c00b214c40074d0c666e35d589a5bc9ccc0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6e9828f025e235f6bf464d8485898540f13e13d1a55564fdd558f93e4ccc125a494627138fc483e3d3eff27044da3b993baf8df84ede598357f13907020e8ce4
|
|
7
|
+
data.tar.gz: 3630906909fffe1b9d8310a51777307abf587726c24a577ff5777735696927f537de077c0b3ddfdc7e31fd35cd8216a2c37b4c082bdbf34ad683ab21e310dfe1
|
data/lib/pg_conn/version.rb
CHANGED
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
|
|
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
|
|