(clojureql.core/join (clojureql.core/table db :tableA) (clojureql.core/table db :tableA)
(clojureql.core/where (apply and (= :tableA.id :tableB.id)
[(apply or [(clojureql.predicates/in :tableA.id [1 2])
(clojureql.predicates/in :tableA.id [3 4])])])))
I'd like to call another function for the "apply or" form, something like this:
(clojureql.core/join (clojureql.core/table db :tableA) (clojureql.core/table db :tableA)
(clojureql.core/where (apply and (= :tableA.id :tableB.id)
[(my-or-f)])))
Here's the sql that I'd like to form:
(clojureql.core/join (clojureql.core/table db :tableA) (clojureql.core/table db :tableA) (clojureql.core/where (apply and (= :tableA.id :tableB.id) [(apply or [(clojureql.predicates/in :tableA.id [1 2]) (clojureql.predicates/in :tableA.id [3 4])])])))
I'd like to call another function for the "apply or" form, something like this:
(clojureql.core/join (clojureql.core/table db :tableA) (clojureql.core/table db :tableA) (clojureql.core/where (apply and (= :tableA.id :tableB.id) [(my-or-f)])))
where my-of-f function is:
(defn my-or-f [](apply or [%28clojureql.predicates/in :tableA.id [1 2]%29 %28clojureql.predicates/in :tableA.id [3 4]%29]))
however this function throws this exception: java.lang.Exception: Can't take value of a macro: #'clojure.core/or (NO_SOURCE_FILE:2)
I've also tried using a macro for my-or-f. It compiles but it throws the same exception when I try running the query using this macro
(defmacro my-or-f [] `(apply or [(clojureql.predicates/in :tableA.id [1 2]) (clojureql.predicates/in :tableA.id [3 4])]))
Is there another way that I could use the "apply or"?
Thanks.