pg_json 0.1.20 → 0.1.21
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.
- data/bin/pg_json +5 -2
- data/lib/pg_json/sequel/pg_json.rb +7 -4
- metadata +2 -2
data/bin/pg_json
CHANGED
@@ -87,9 +87,12 @@ simple :time do
|
|
87
87
|
# "'\"'||to_char(data, 'HH24:MI:SS')::text||'\"'"
|
88
88
|
"'{\"__type__\":\"time\",\"value\":\"'||to_char(data, 'HH24:MI:SS')::text||'\"}'"
|
89
89
|
end
|
90
|
+
# simple :timestamp do
|
91
|
+
# # "extract(epoch from data)::integer::text"
|
92
|
+
# "'{\"__type__\":\"timestamp\",\"value\":'||extract(epoch from data)::integer::text||'}'"
|
93
|
+
# end
|
90
94
|
simple :timestamp do
|
91
|
-
|
92
|
-
"'{\"__type__\":\"timestamp\",\"value\":'||extract(epoch from data)::integer::text||'}'"
|
95
|
+
"'{\"__type__\":\"timestamp\",\"value\":'||to_char(data, 'YYYY-MM-DD\"T\"HH24:MI:SS\"+02:00\"')||'}'"
|
93
96
|
end
|
94
97
|
|
95
98
|
while composite = ARGV.slice!(0)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "date"
|
2
|
+
|
1
3
|
JSON_TYPES = {} unless defined? JSON_TYPES
|
2
4
|
JSON_TYPES[:date] = lambda do |v|
|
3
5
|
v.nil? ? nil : v.to_date
|
@@ -5,11 +7,12 @@ end
|
|
5
7
|
JSON_TYPES[:time] = lambda do |v|
|
6
8
|
v.nil? ? nil : v.to_time
|
7
9
|
end
|
8
|
-
JSON_TYPES[:datetime] = lambda do |v|
|
9
|
-
|
10
|
-
end
|
10
|
+
# JSON_TYPES[:datetime] = lambda do |v|
|
11
|
+
# v.nil? ? nil : v.to_datetime
|
12
|
+
# end
|
11
13
|
JSON_TYPES[:timestamp] = lambda do |v|
|
12
|
-
|
14
|
+
# format '2012-04-21T00:00:00+0200'
|
15
|
+
v.nil? ? nil : DateTime.parse(v).to_time
|
13
16
|
end
|
14
17
|
|
15
18
|
class Hash
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pg_json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.21
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-22 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: bring basic json support to postgresql
|
15
15
|
email: jan.zimmek@web.de
|