brianc / node-sql

SQL generation for node.js
MIT License
1.05k stars 191 forks source link

Support INTERVAL arithmetic #170

Open dickfickling opened 10 years ago

dickfickling commented 10 years ago

http://www.postgresql.org/docs/9.3/static/datatype-datetime.html#DATATYPE-INTERVAL-INPUT

https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-add

Is this on the roadmap, or done already? If not, I'll probably do it myself and submit a pull request, I just didn't want to duplicate work.

geon commented 9 years ago

You can work around it with like this:

myTable.someTimestamp.plus(myTable.literal("(INTERVAL '1 hour')")
brianc commented 9 years ago

Hi! It's not on the roadmap currently & I know we'd love a pull-request for the feature! :) If you get to it we'd love to merge it in. Also if you need any help or advice implementing the feature I know we'd be happy to chip in.

On Fri, Dec 5, 2014 at 7:11 AM, Victor Widell notifications@github.com wrote:

You can work around it with like this:

myTable.someTimestamp.plus(myTable.literal("(INTERVAL '1 hour')")

— Reply to this email directly or view it on GitHub https://github.com/brianc/node-sql/issues/170#issuecomment-65782177.