Reputation: 38771
I was surprised that this didn't work:
(d/q '[:find [?e ...]
:in $ ?field ?op ?value
:where [?e ?field ?x]
[(?op ?x ?value)]
]
db
:my/field
>
10))
If I remove the op and explicitly code in > in the where clause it works. Can I not use input parameters to refer to core clojure functions? Would a rule help? Or would I need to build up the entire query at runtime using quoting/unquotinq?
Thanks.
Upvotes: 1
Views: 247
Reputation: 6061
Try this:
(defn invoke [f & args] (apply f args))
(d/q '[:find [?e ...]
:in $ ?field ?op ?value
:where
[?e ?field ?x]
[(myapp.utils.datomic/invoke ?op ?x ?value)]]
db :my/field > 10)
Upvotes: 2