generated from tpl/purs
Drop pg import from Value.js
so typeclasses are accessible for frontend JS.
This commit is contained in:
parent
60894e9f23
commit
67960570a5
@ -1,7 +1,15 @@
|
|||||||
|
/* global exports, require */
|
||||||
|
/* jshint -W097 */
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var pg = require('pg');
|
var pg = require('pg');
|
||||||
|
|
||||||
|
// pg does strange thing converting DATE
|
||||||
|
// value to js Date, so we have
|
||||||
|
// to prevent this craziness
|
||||||
|
pg.types.setTypeParser(1082 /* DATE_OID */, function(dateString) { return dateString; });
|
||||||
|
|
||||||
exports.ffiNewPool = function(config) {
|
exports.ffiNewPool = function(config) {
|
||||||
return function() {
|
return function() {
|
||||||
return new pg.Pool(config);
|
return new pg.Pool(config);
|
||||||
@ -19,9 +27,9 @@ exports.ffiConnect = function (config) {
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}).catch(function(err) {
|
}).catch(function(err) {
|
||||||
var pgError = config.nullableLeft(err)
|
var pgError = config.nullableLeft(err);
|
||||||
if (pgError) {
|
if (pgError) {
|
||||||
onSuccess(pgError)
|
onSuccess(pgError);
|
||||||
} else {
|
} else {
|
||||||
onError(err);
|
onError(err);
|
||||||
}
|
}
|
||||||
@ -45,11 +53,11 @@ exports.ffiUnsafeQuery = function(config) {
|
|||||||
values: values,
|
values: values,
|
||||||
rowMode: 'array',
|
rowMode: 'array',
|
||||||
}).then(function(result) {
|
}).then(function(result) {
|
||||||
onSuccess(config.right(result))
|
onSuccess(config.right(result));
|
||||||
}).catch(function(err) {
|
}).catch(function(err) {
|
||||||
var pgError = config.nullableLeft(err);
|
var pgError = config.nullableLeft(err);
|
||||||
if (pgError) {
|
if (pgError) {
|
||||||
onSuccess(pgError)
|
onSuccess(pgError);
|
||||||
} else {
|
} else {
|
||||||
onError(err);
|
onError(err);
|
||||||
}
|
}
|
||||||
@ -67,7 +75,7 @@ exports.ffiUnsafeQuery = function(config) {
|
|||||||
|
|
||||||
exports.ffiSQLState = function (error) {
|
exports.ffiSQLState = function (error) {
|
||||||
return error.code || null;
|
return error.code || null;
|
||||||
}
|
};
|
||||||
|
|
||||||
exports.ffiErrorDetail = function (error) {
|
exports.ffiErrorDetail = function (error) {
|
||||||
return {
|
return {
|
||||||
@ -89,4 +97,4 @@ exports.ffiErrorDetail = function (error) {
|
|||||||
line: error.line || '',
|
line: error.line || '',
|
||||||
routine: error.routine || ''
|
routine: error.routine || ''
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
|
/* global Buffer, exports, require */
|
||||||
|
/* jshint -W097 */
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// pg does strange thing converting DATE
|
|
||||||
// value to js Date, so we have
|
|
||||||
// to prevent this craziness
|
|
||||||
var pg = require('pg');
|
|
||||||
|
|
||||||
pg.types.setTypeParser(1082 /* DATE_OID */, function(dateString) { return dateString; });
|
|
||||||
|
|
||||||
exports['null'] = null;
|
exports['null'] = null;
|
||||||
|
|
||||||
exports.instantToString = function(i) {
|
exports.instantToString = function(i) {
|
||||||
|
Loading…
Reference in New Issue
Block a user