Skip to content

Commit 7af3243

Browse files
committed
Oops, json_conv test cases are missed.
1 parent 7d60663 commit 7af3243

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

expected/json_conv.out

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
CREATE FUNCTION conv(o json) RETURNS json AS $$
2+
if (o instanceof Array) {
3+
o[1] = 10;
4+
} else if (typeof(o) == 'object') {
5+
o.i = 10;
6+
}
7+
return o;
8+
$$ LANGUAGE plv8;
9+
SELECT conv('{"i": 3, "b": 20}');
10+
conv
11+
-----------------
12+
{"i":10,"b":20}
13+
(1 row)
14+
15+
SELECT conv('[1, 2, 3]');
16+
conv
17+
----------
18+
[1,10,3]
19+
(1 row)
20+

sql/json_conv.sql

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CREATE FUNCTION conv(o json) RETURNS json AS $$
2+
if (o instanceof Array) {
3+
o[1] = 10;
4+
} else if (typeof(o) == 'object') {
5+
o.i = 10;
6+
}
7+
return o;
8+
$$ LANGUAGE plv8;
9+
10+
SELECT conv('{"i": 3, "b": 20}');
11+
SELECT conv('[1, 2, 3]');

0 commit comments

Comments
 (0)