dmanjunath / node-redshift

A simple collection of tools to help you get started with Amazon Redshift from node.js
69 stars 48 forks source link

pg.types in node-redshift #14

Closed Noursounet closed 7 years ago

Noursounet commented 7 years ago

Hi,

When a date is pulled from RedShift, nodejs makes a "new Date()", so we depend on Local timezone. pg offers the possibility to override types parsing:

var pg = require('pg');
var types = pg.types;

var TIMESTAMP_OID = 1114;
var parseDateFn = function (val) {
    return val === null ? null : val;
};
types.setTypeParser(TIMESTAMP_OID, parseDateFn);

Unfortunately the node-redshift npm doesn't export this pg.types object and so we can't modify the way javascript will parse redshift data.

Would it be possible to add it?

Thanks

dmanjunath commented 7 years ago

Yeah great suggestion @Noursounet. Turns out it was a one liner to add it to redshift object. I've pushed up the code already. I'll update the readme and I'll do an npm push sometime today.

Noursounet commented 7 years ago

Thanks a lot!

Noursounet commented 7 years ago

Hi @dmanjunath,

Sorry for bothering but i was wandering when are you planning to publish the new npm version ? ^^

Thanks a lot!

Noursounet

dmanjunath commented 7 years ago

@Noursounet sorry about the delay but I published it about three hours ago! Look for version 0.1.2.

On Apr 24, 2017, at 11:28 AM, Noursounet notifications@github.com wrote:

Hi @dmanjunath,

Sorry for bothering but i was wandering when are you planning to publish the new npm version ? ^^

Thanks a lot!

Noursounet

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

Noursounet commented 7 years ago

Great! Thanks a lot