Infinty for different data types
Hi!
I'm struggling with this task: sometimes I need to send timestamp as infinity (0Wp). Is it possible? Perhaps typed could take Infinity or some parameter that means "I want to deserialize it as null/inf etc... on kdb side"?
Thanks!
From looking at the code I don't think that it is possible at the moment.
The only workaround would be to send the whole command as a string:
con.k("something[1;0Wp]", function(err, res) { ... });
Unfortunately I need this for .u.upd command, I create a javascript array with timestamps. I can send nulls but can't send infinity.
But in theory can we have 2 additional states/flags (+Inf/-Inf) for typed data? I think it can be checked at deserialization moment and every type can turn the inf value into correct 0W value before sending it to kdb.
For writing, we use the JavaScript Date type which does not support the idea of infinity. So you are in a bad position.
You can switch from Date to Number (then with nano second precission) with the nanos2date flag but only when reading.
To solve this issue, you would need to make a change to support writing of a JavaScript Number (in nano seconds) as a timestamp: https://github.com/michaelwittig/node-q/blob/master/lib/c.js#L703 and you would need to allow to pass a Number into the typed api https://github.com/michaelwittig/node-q/blob/master/lib/typed.js#L158
Interesting, I'll try this idea, thanks!