Closed stevebuik closed 3 years ago
@stevebuik same in ClojureScript for me.
I've found a workaround:
(let [db (dx/create-dx [{:db/id 1, :name "Ivan" :age 15}
{:db/id 2, :name "Petr" :age 37}])
age2 15]
[; returns a value
(dx/q [:find ?name
:in ?age
:where
[?e :name ?name]
[?e :age ?age]]
db 15)
; workaround
(dx/q [:find ?name
:in ?ageee
:where
[?e :name ?name]
[?e :age ?age]
[(= ?age ?ageee)]]
db age2)])
interesting. I have been testing this on the jvm and that workaround didn't work there. I wonder if this behaves differently on clj vs cljs?
The fact that it doesn't work as an argument after the db on jvm is a bug. It worked, but there was no test so it got messed up somewhere. I'll fix it today. When it comes to using arguments inside the query, put a tilde in front of the variable
(let [db (dx/create-dx [{:db/id 1, :name "Ivan" :age 15}
{:db/id 2, :name "Petr" :age 37}])
age 15]
(dx/q [:find ?name
:where
[?e :name ?name]
[?e :age ~age]]
db))
;; => [["Ivan"]]
Fixed.
thanks. closing this one.
I guess this is similar to https://github.com/ribelo/doxa/issues/5
Does this mean that the only value that can be used as runtime args to dx/q is the db value?
Is it possible for runtime args to work while still using meander? Or is the answer the same as for #5 ?
I want to know so I can explain this properly in my sample application