(defn e-by-av [db a v]
(-> (d/datoms db :avet a v) first :e))
Might in many cases be more efficient than this, (even if adjusted to make use of ssolo etc, and why you wouldn't want to do a straight datom search in these cases
(defn find-by
"Returns the unique entity identified by either attr (for singleton
entities) or attr and val."
([db attr]
(qe '[:find ?e
:in $ ?attr
:where [?e ?attr]]
db attr))
([db attr val]
(qe '[:find ?e
:in $ ?attr ?val
:where [?e ?attr ?val]]
db attr val)))
I'm curious whether this
Might in many cases be more efficient than this, (even if adjusted to make use of ssolo etc, and why you wouldn't want to do a straight datom search in these cases