pg_conn 0.28.0 → 0.29.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/TODO +8 -5
- data/lib/pg_conn/version.rb +1 -1
- data/lib/pg_conn.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba42158e0277b532ebcdb7125dd0c963de3c936a4bdb918e1a980fd6aa2674ed
|
4
|
+
data.tar.gz: c371efcf188d9c49b7e005e2cb4f92f72431b6b20e0fbd4766904d8b99743ed4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d518daefe587aca974092084628505c9c82a8615e4cda9baf3ea3b3526ebdf2e48be1adc0bfe4231f4b617353359c0942f16f6d97c33bc67cc744db0dd7d11f
|
7
|
+
data.tar.gz: b534cc5f4669c84e6248f57aa6abef4678d37405b6008814f74521d9c691cc0cd4b4983795429832f40c9618071248887ba5b3bcb09c2fd05ca21f37126ae696
|
data/TODO
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
TODO
|
2
|
-
o Add a
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
o Add support for hstore (a hash)
|
3
|
+
|
4
|
+
o Add a <fetch>! method. Require v2
|
5
|
+
value? 0 or 1
|
6
|
+
value 1
|
7
|
+
values 0 or n
|
8
|
+
values? 0 or n
|
9
|
+
values! 1 or more
|
7
10
|
|
8
11
|
o Instrumentation of connection object
|
9
12
|
|
data/lib/pg_conn/version.rb
CHANGED
data/lib/pg_conn.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "pg"
|
2
2
|
require 'ostruct'
|
3
|
+
require 'json'
|
3
4
|
|
4
5
|
require_relative "pg_conn/version"
|
5
6
|
require_relative "pg_conn/role_methods"
|
@@ -269,6 +270,10 @@ module PgConn
|
|
269
270
|
# true/false, Time/Date/DateTime, and arrays. Other types may require
|
270
271
|
# special handling
|
271
272
|
#
|
273
|
+
# Hashes are quoted as a literal JSON expression. The result is a string
|
274
|
+
# and it is the application's responsibility to cast them to either 'json'
|
275
|
+
# or 'jsonb'
|
276
|
+
#
|
272
277
|
# Note that a tuple value (an array) must be quoted using #quote_tuple
|
273
278
|
# because #quote_value would quote the tuple as an array instead of a list
|
274
279
|
# of values
|
@@ -294,6 +299,7 @@ module PgConn
|
|
294
299
|
else
|
295
300
|
"array[#{value.map { |elem| quote_value(elem) }.join(', ')}]"
|
296
301
|
end
|
302
|
+
when Hash; value.to_json
|
297
303
|
else
|
298
304
|
@pg_connection.escape_literal(value.to_s)
|
299
305
|
end
|
@@ -346,6 +352,8 @@ module PgConn
|
|
346
352
|
#
|
347
353
|
# Return true iff the query returns exactly one record. Use '!empty?' to
|
348
354
|
# check if the query returns one or more records
|
355
|
+
#
|
356
|
+
# TODO: Rename #present? and use #exists? to query schema objects
|
349
357
|
def exist?(*query)
|
350
358
|
!empty?(*query)
|
351
359
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pg_conn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.29.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claus Rasmussen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|