 (defn get-ident [a]
   (:db/ident (first (filter #(= a (:db/id %)) @schema-ents))))
 
+(defn metadata [a]
+  (let [ent (first (filter #(or (= a (:db/id %))
+                                (= a (:db/ident %))) @schema-ents))]
+    (select-keys ent (filter #(= "metadata" (namespace %)) (keys ent)))))
+
+(defn unescaped? [a]
+  (:metadata/unescaped (metadata a)))
+
 (defn get-schema-ents [db]
   (pcd/touch-all '{:find [?t]
                    :where [[?t :db/ident ?ident]]}

(defn ensure-schema
  ([] (ensure-schema (pcd/conn)))
  ([conn]
   (let [res @(d/transact conn schema)
         ents (get-schema-ents (:db-after res))]
     (reset! schema-ents ents)
     res)))

              :db/index true)

   (attribute :session/client-id
              :db.type/string
              :metadata/unescaped true)

   (attribute :document/uuid
              :db.type/uuid
              :db/index true)

   (attribute :document/name
              :db.type/string
              :metadata/unescaped true)

   (attribute :document/creator
              :db.type/uuid
