Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
///
import * as types from "pg-types";
types.getTypeParser(1184, 'text');
types.setTypeParser(1184, (value) => value === null ? null : value);
types.setTypeParser(1186, 'text', (value) => value === null ? null : value);
types.setTypeParser(1186, 'binary', (value) => value.toISOString());
types.setTypeParser(1185, (value) => types.arrayParser.create(value, (x) => x).parse());
var TIMESTAMPTZ_OID = 1184
var TIMESTAMP_OID = 1114
var parseFn = function(val: any) {
return val === null ? null : moment(val)
}
types.setTypeParser(TIMESTAMPTZ_OID, parseFn)
types.setTypeParser(TIMESTAMP_OID, parseFn)
///
///
import * as types from "pg-types";
types.getTypeParser(1184, 'text');
types.setTypeParser(1184, (value) => value === null ? null : value);
types.setTypeParser(1186, 'text', (value) => value === null ? null : value);
types.setTypeParser(1186, 'binary', (value) => value.toISOString());
types.setTypeParser(1185, (value) => types.arrayParser.create(value, (x) => x).parse());
var TIMESTAMPTZ_OID = 1184
var TIMESTAMP_OID = 1114
var parseFn = function(val: any) {
return val === null ? null : moment(val)
}
types.setTypeParser(TIMESTAMPTZ_OID, parseFn)
types.setTypeParser(TIMESTAMP_OID, parseFn)
///
///
import * as types from "pg-types";
types.getTypeParser(1184, 'text');
types.setTypeParser(1184, (value) => value === null ? null : value);
types.setTypeParser(1186, 'text', (value) => value === null ? null : value);
types.setTypeParser(1186, 'binary', (value) => value.toISOString());
types.setTypeParser(1185, (value) => types.arrayParser.create(value, (x) => x).parse());
var TIMESTAMPTZ_OID = 1184
var TIMESTAMP_OID = 1114
var parseFn = function(val: any) {
return val === null ? null : moment(val)
}
types.setTypeParser(TIMESTAMPTZ_OID, parseFn)
types.setTypeParser(TIMESTAMP_OID, parseFn)
import * as types from "pg-types";
types.getTypeParser(1184, 'text');
types.setTypeParser(1184, (value) => value === null ? null : value);
types.setTypeParser(1186, 'text', (value) => value === null ? null : value);
types.setTypeParser(1186, 'binary', (value) => value.toISOString());
types.setTypeParser(1185, (value) => types.arrayParser.create(value, (x) => x).parse());
const TIMESTAMPTZ_OID = 1184;
const TIMESTAMP_OID = 1114;
types.setTypeParser(TIMESTAMPTZ_OID, parseInt);
types.setTypeParser(TIMESTAMP_OID, parseInt);
import * as types from "pg-types";
types.getTypeParser(1184, 'text');
types.setTypeParser(1184, (value) => value === null ? null : value);
types.setTypeParser(1186, 'text', (value) => value === null ? null : value);
types.setTypeParser(1186, 'binary', (value) => value.toISOString());
types.setTypeParser(1185, (value) => types.arrayParser.create(value, (x) => x).parse());
var TIMESTAMPTZ_OID = 1184
var TIMESTAMP_OID = 1114
var parseFn = function(val: any) {
return val === null ? null : moment(val)
}
types.setTypeParser(TIMESTAMPTZ_OID, parseFn)
types.setTypeParser(TIMESTAMP_OID, parseFn)
helper.pg.connect(helper.config, assert.success(function(client, done) {
var types = require('pg-types');
//1231 = numericOID
types.setTypeParser(1700, function(){
return 'yes';
})
types.setTypeParser(1700, 'binary', function(){
return 'yes';
})
var bignum = '294733346389144765940638005275322203805';
client.query('CREATE TEMP TABLE bignumz(id numeric)');
client.query('INSERT INTO bignumz(id) VALUES ($1)', [bignum]);
client.query('SELECT * FROM bignumz', assert.success(function(result) {
assert.equal(result.rows[0].id, 'yes')
helper.pg.end();
done();
}))
}));
if (!isSafeInteger(i)) {
throw new Error(format("The value '%s' cannot be represented by a javascript number.", val));
}
return i;
});
var timestampOrig = PgTypes.getTypeParser(1114, "text");
PgTypes.setTypeParser(1184, "text", function (val) {
return getPatio().stringToDate(val.toString());
});
PgTypes.setTypeParser(1082, "text", function (val) {
return getPatio().stringToDate(val.toString());
});
PgTypes.setTypeParser(1083, "text", function (val) {
val = String(val);
if (!val.match(/\.(\d{0,3})/)) {
val += ".000";
} else {
val = val.replace(/\.(\d{0,3})$/, function (m, m1) {
return "." + pad(m1, 3, "0", true);
});
}
return getPatio().stringToTime(val.toString(), DS.TIME_FORMAT);
});
PgTypes.setTypeParser(1700, "text", parseFloat);
PgTypes.setTypeParser(114, "text", function (data) {
return getPatio().sql.json(JSON.parse(data));
});
return getPatio().stringToDate(val.toString());
});
PgTypes.setTypeParser(1083, "text", function (val) {
val = String(val);
if (!val.match(/\.(\d{0,3})/)) {
val += ".000";
} else {
val = val.replace(/\.(\d{0,3})$/, function (m, m1) {
return "." + pad(m1, 3, "0", true);
});
}
return getPatio().stringToTime(val.toString(), DS.TIME_FORMAT);
});
PgTypes.setTypeParser(1700, "text", parseFloat);
PgTypes.setTypeParser(114, "text", function (data) {
return getPatio().sql.json(JSON.parse(data));
});
var Connection = define(null, {
instance: {
connection: null,
errored: false,
closed: false,
var byteaParser = function (val) {
if (val.toString().indexOf("\\x") === 0) {
val = val.toString().replace(/^\\x/, "");
return new Buffer(val, "hex");
} else {
val = val.toString().replace(/\\([0-7]{3})/g, function (fullMatch, code) {
return String.fromCharCode(parseInt(code, 8));
}).replace(/\\\\/g, "\\");
return new Buffer(val, "binary");
}
};
PgTypes.setTypeParser(17, "text", byteaParser);
PgTypes.setTypeParser(20, 'text', function (val) {
if (!getPatio().parseInt8) {
return val;
}
var i = parseInt(val, 10);
if (!isSafeInteger(i)) {
throw new Error(format("The value '%s' cannot be represented by a javascript number.", val));
}
return i;
});
var timestampOrig = PgTypes.getTypeParser(1114, "text");
PgTypes.setTypeParser(1184, "text", function (val) {
return getPatio().stringToDate(val.toString());
});
PgTypes.setTypeParser(1083, "text", function (val) {
val = String(val);
if (!val.match(/\.(\d{0,3})/)) {
val += ".000";
} else {
val = val.replace(/\.(\d{0,3})$/, function (m, m1) {
return "." + pad(m1, 3, "0", true);
});
}
return getPatio().stringToTime(val.toString(), DS.TIME_FORMAT);
});
PgTypes.setTypeParser(1700, "text", parseFloat);
PgTypes.setTypeParser(114, "text", function (data) {
return getPatio().sql.json(JSON.parse(data));
});
var Connection = define(null, {
instance: {
connection: null,
errored: false,
closed: false,
constructor: function (conn) {
this.connection = conn;