mirror of
https://github.com/brianc/node-postgres.git
synced 2025-12-08 20:16:25 +00:00
Parse arrays: json[], uuid[]
This commit is contained in:
parent
a3c08d19c0
commit
67a47b9025
@ -178,6 +178,16 @@ var parseBigInteger = function(val) {
|
||||
return val;
|
||||
};
|
||||
|
||||
var parseJsonArray = function(val) {
|
||||
var arr = parseStringArray(val);
|
||||
|
||||
if (!arr) {
|
||||
return arr;
|
||||
}
|
||||
|
||||
return arr.map(function(el) { return JSON.parse(el); });
|
||||
};
|
||||
|
||||
var init = function(register) {
|
||||
register(20, parseBigInteger); // int8
|
||||
register(21, parseInteger); // int2
|
||||
@ -202,6 +212,8 @@ var init = function(register) {
|
||||
register(1186, parseInterval);
|
||||
register(17, parseByteA);
|
||||
register(114, JSON.parse.bind(JSON));
|
||||
register(199, parseJsonArray); // json[]
|
||||
register(2951, parseStringArray); // uuid[]
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pg",
|
||||
"version": "2.7.0",
|
||||
"version": "2.7.1",
|
||||
"description": "PostgreSQL client - pure javascript & libpq with the same API",
|
||||
"keywords": [
|
||||
"postgres",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user