I’ve been trying to parameterize the pull-pattern in a query.
https://docs.datomic.com/cloud/query/query-data-reference.html#pattern-inputs
So far, this works as expected.
(d/q {:args [db "ckirgf9sy000t3g5zobk9ukqk" '[*]]
:query '[:find (pull ?e pattern)
:in $ ?id pattern
:where [?e :system/id ?id]]})
Sharing a pattern works.
(d/q {:args [db '[*] [["ckirgf9sy000t3g5zobk9ukqk"]
["ckgaw9q63000n3h5whaqu3svc"]]]
:query '[:find (pull ?e pattern)
:in $ pattern [[?id] ...]
:where [?e :system/id ?id]]})
Somehow it raise an error when each relation have its own pattern.
(d/q {:args [db [["ckirgf9sy000t3g5zobk9ukqk" '[*]]
["ckgaw9q63000n3h5whaqu3svc" '[:db/id]]]]
:query '[:find (pull ?e pattern)
:in $ [[?id pattern] ...]
:where [?e :system/id ?id]]})
Error message
Execution error (ExceptionInfo) at datomic.core.error/raise (error.clj:55).
:db.error/pattern-not-bound Pull pattern not found in inputs: pattern
The syntax seems okay, but is it a valid use case for positional destructure?