Closed benbro closed 4 years ago
Interesting, thanks. Wonder if there is something we aren't doing for the interval type. Also, technically this issue would go on https://github.com/tsloughter/pg_types but this is fine.
Getting tot his one now too and mostly have a fix. Just not sure what format to return the result in.
The issue starts with I had only a test for encoding intervals and not decoding. The one that was supposed to be decoding was really just decoding timestamps.
But how best to represent a 7 day interval in Erlang?
Derp, nevermind, the encode makes it clear. So the result would be:
{interval, {0, 7, 0}}
Sound good?
Just {0, 7, 0} without 'interval' is better. Less verbose. Will it be possible to encoding it?
Hm, I ended up with {interval, {{0,0,0}, 7, 0}}
.. The reason is that the first part decodes to the hours, minutes, seconds.
I suppose I can get rid of the interval
atom, tho I often really think we should be using records or maps for these data types.
master is now updated to support this but with the format {interval, {{0,0,0}, 7, 0}}
for now.
Thanks