brianc/node-pg-types

Not able to use with modules

Thallius opened this issue · 1 comments

Hi,

it might be my fault but I am unable to use pg-types with javascript modules.

I tried

import * as pgTypes from 'pg-types';
pgTypes.setTypeParser(1114, function(stringValue)
{
console.log("Type Parser");
return new Date(stringValue + "+0000");
});

but the function is never called.

As I said my fault:

The correct way is:

import types from 'pg';
types.types.setTypeParser(1082, function(stringValue)
{
console.log("Type Parser");
return new Date(stringValue + "+0000");
});