-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Maybe a no-op, but is there an option to query a field that's missing in the source data map?
Maybe some
(let [db (dx/create-dx [{:db/id 1 :m/gist "ggg"} ; <- no :m/status field
{:db/id 2 :m/status false :m/gist "ggg"}])
q-status #{nil false true}]
(dx/q [:find ?e
:in ?pat ?q-status
:where
[?e :m/gist ?g]
[?e :m/status ?status] ; <- maybe some default binding here?
[(re-find ?pat ?g)]
[(contains? ?q-status ?status)]]
db #"" q-status)))
; yields [[2]]Or, alternatively, to dynamically compose a query like here
(let [db (dx/create-dx [{:db/id 1 :m/gist "ggg"} {:db/id 2 :m/status false :m/gist "ggg"}])
q-status nil
cond1 (if (nil? q-status)
['?e :db/id]
['?e :m/status '?status])]
(dx/q [:find ?e
:in ?pat ?q-status
:where
[?e :m/gist ?g]
cond1
[(re-find ?pat ?g)]]
db #"" q-status)))Metadata
Metadata
Assignees
Labels
No labels