pg_conn 0.50.0 → 0.52.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/schema_methods.rb +1 -1
- data/lib/pg_conn/version.rb +1 -1
- data/lib/pg_conn.rb +11 -3
- 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: 4eb14bc0e0da731fe50455d9a2a7826da327d2ceb22d7a87b902fe0e5e2b38a8
|
|
4
|
+
data.tar.gz: a7769e72c3477e973846dffb34946b5ff234c3810dc35ae9cd239cf95e5b3fb6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 55b80c0204381dc399d2edeeaddeb505c6b12f98fabf9ff81e7003deec55229a7c8db58b3bbb90a452532f90345df79a9d5e89faa654d94c010437d71750e57f
|
|
7
|
+
data.tar.gz: 77fbabcf5e0eaf85b0bfe487b5f721dc7ee7b5cd7190cdfa32fafc9aa86a664f377f6557860c9a037329a24ae9e9d436e061daf95846863f2725876b5a7c3b0c
|
|
@@ -117,7 +117,7 @@ module PgConn
|
|
|
117
117
|
end
|
|
118
118
|
|
|
119
119
|
# Return type of the given column or nil if not found
|
|
120
|
-
def
|
|
120
|
+
def column_type(schema, relation = nil, column)
|
|
121
121
|
conn.tuples(column_list_type_query(schema, relation, column)).first&.last
|
|
122
122
|
end
|
|
123
123
|
|
data/lib/pg_conn/version.rb
CHANGED
data/lib/pg_conn.rb
CHANGED
|
@@ -93,6 +93,11 @@ module PgConn
|
|
|
93
93
|
end
|
|
94
94
|
end
|
|
95
95
|
|
|
96
|
+
# Simple shorthand for ::quote_value
|
|
97
|
+
def self.quote(value, elem_type: nil, json_type: nil)
|
|
98
|
+
quote_value(value, elem_type: nil, json_type: nil)
|
|
99
|
+
end
|
|
100
|
+
|
|
96
101
|
# Quote values and concatenate them using ',' as separator
|
|
97
102
|
def self.quote_values(values, **opts)
|
|
98
103
|
Literal.new values.map { |value| quote_value(value, **opts) }.join(", ")
|
|
@@ -486,6 +491,9 @@ module PgConn
|
|
|
486
491
|
def quote_tuple(tuple, **opts) = PgConn.quote_tuple(tuple, json_type: self.default_json_type, **opts)
|
|
487
492
|
def quote_tuples(tuples, **opts) = PgConn.quote_tuples(tuples, json_type: self.default_json_type, **opts)
|
|
488
493
|
|
|
494
|
+
# Simple shorthand for #quote_value
|
|
495
|
+
alias_method :quote, :quote_value
|
|
496
|
+
|
|
489
497
|
# Quote an array as a list. Eg. ["1", 2] => ('1', 2)
|
|
490
498
|
def quote_list(values, **opts) = quote_tuples([values], **opts)
|
|
491
499
|
|
|
@@ -495,10 +503,10 @@ module PgConn
|
|
|
495
503
|
#
|
|
496
504
|
# Note that the fields are retrived from the database so this method is not
|
|
497
505
|
# as fast as the other quote-methods. It is however very convenient when
|
|
498
|
-
# you're testing and need a composite type because record-quoting
|
|
499
|
-
# easily become unwieldly
|
|
506
|
+
# you're testing and need a composite type because record-quoting by hand
|
|
507
|
+
# can easily become unwieldly
|
|
500
508
|
#
|
|
501
|
-
# Also note that there is
|
|
509
|
+
# Also note that there is no class-method variant of this method because
|
|
502
510
|
# it requires a connection
|
|
503
511
|
def quote_record(data, schema_name = nil, type, **opts)
|
|
504
512
|
quote_record_impl(data, schema_name, type, array: false, **opts)
|