       db)))
 
 (defn query-entity
-  "Like query-entities, but returns a single result. This leverage datomic
+  "Like query-entities, but returns a single result. This leverage Datomic
   single result :find, meaning it is effectively more efficient than query-entities."
   [{::keys [db] :as env} dquery]
   (let [subquery (entity-subquery env)]


(defn entity-subquery
  "Using the current :query in the env, compute what part of it can be
  delegated to datomic."
  [{:keys [query] :as env}]
  (let [subquery (filter-subquery (assoc env ::p/parent-query query ::p/entity {:db/id nil}))]
    (cond-> subquery (not (seq subquery)) (conj :db/id))))

(defn query-entities
  "Use this helper from inside a resolver to run a datomic query.

  You must send dquery using a datalog map format. The :find section
  of the query will be populated by this function with [[pull ?e SUB_QUERY] '...].

  {::db (d/db conn)})

(defn db->schema
  "Extracts the schema from a Datomic db."
  [db]
  (->> (d/q '[:find [(pull ?e [*]) ...]
              :where
