How would I use clojureql to select between two dates? Hopefully something like this:
@(-> (table :abc)
(select (where (between d1 d2))))
You can write your own between
(defmacro between
[x min max]
`(and (< ~min ~x) (< ~x ~max)))
This will be compatible with ClojureQL.
There is no BETWEEN
, and while you might be tempted to use Lisp-y multiple-argument <
, that does not work either:
;; invalid SQL output
hello-cql.core> (select (table :abc) (where (< 10 :a 20)))
SELECT abc.* FROM abc WHERE (10 < a < 20)
;; valid SQL output
hello-cql.core> (select (table :abc) (where (and (< 10 :a) (< :a 20))))
SELECT abc.* FROM abc WHERE ((10 < a) AND (a < 20))