Closed currentoor closed 7 years ago
There should be an analog to datomic.api/pluck-many. The pluck handlers for specific keys in this case should return collections, to avoid n+1 queries.
datomic.api/pluck-many
n+1
(defmethod -pluck-many :dashboard/org-time [k {db :db} dashboards] (->> (d/q '[:find ?d ?created-at :in $ [?d ...] :where [?d :dashboard/organization _ ?org-tx _] [?org-tx :db/txInstant ?created-at]] db (map :db/id dashboards)) (into []))) (pluck-many {:db db} [:db/id :dashboard/title :dashboard/org-time] [d1 d2]) ;=> [{:db/id d1 :dashboard/title "FooBar" :dashboard/org-time #inst "2016-08-20T22:10:26.652-00:00"} ;=> {:db/id d2 :dashboard/title "BarFoo" :dashboard/org-time #inst "2016-08-21T22:10:26.652-00:00"}]
There should be an analog to
datomic.api/pluck-many
. The pluck handlers for specific keys in this case should return collections, to avoidn+1
queries.