Skip to content

Commit

Permalink
sidestep compilation issue encountered when eval'ing some korma
Browse files Browse the repository at this point in the history
where queries
  • Loading branch information
mccraigmccraig committed Jun 4, 2013
1 parent be992d1 commit b70357a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/qseq/korma.clj
Expand Up @@ -10,11 +10,14 @@
[query]
(or (-> query meta :key) (-> query :ent :pk) :id))

(def ^:dynamic ^:private *q* nil)
(defn eval-where
"blah blah macros"
"blah blah macros. if the query is inserted into the eval template it works with many
queries, but fails to compile some queries. using a dynamic variable sidesteps the issue"
[query conds]
(eval
`(korma.core/where ~query ~conds)))
(binding [*q* query]
(eval
`(korma.core/where @#'*q* ~conds))))

(defn q-empty
"return a query which will match no rows"
Expand Down

0 comments on commit b70357a

Please sign in to comment.