bendrucker / postgres-interval

Parse Postgres interval columns
MIT License
33 stars 19 forks source link

Is a slight refactor welcome? #33

Closed benjie closed 4 years ago

benjie commented 4 years ago

Hey @bendrucker, thanks for your work on this project!

I've re-implemented the parse function in PostGraphile, with the following changes (roughly):

Would you like me to replicate these changes in a PR to postgres-interval? I'm pretty confident I can do it in a non-breaking way (it won't be a complete copy of the above code because I'll need to add milliseconds back in, at least).

The result of this change would be:

If this is not of interest; feel free to close this issue :+1:

bendrucker commented 4 years ago

Yes, this sounds good! This code is pretty old. Would like to see some benchmarks around any perf oriented changes but certainly anything you think improves readability is more than welcome.