显示用户定义的属性:
(clojure.pprint/print-table (->> (d/pull db '{:eid 0 :selector [{:db.install/attribute [*]}]})
:db.install/attribute
(remove (fn [m] (or (clojure.string/starts-with? (namespace (:db/ident m)) "db") (clojure.string/starts-with? (namespace (:db/ident m)) "fressian"))))
(map #(update % :db/valueType :db/ident))
(map #(update % :db/cardinality :db/ident))
(sort-by :db/ident)))
(改编自get-schema
这里的函数:Datomicion-starter - GitHub)
输出:
| :db/id | :db/ident | :db/valueType | :db/cardinality |
|--------+--------------+------------------+----------------------|
| 74 | :inv/color | :db.type/keyword | :db.cardinality/one |
| 80 | :inv/count | :db.type/long | :db.cardinality/one |
| 75 | :inv/size | :db.type/keyword | :db.cardinality/one |
| 73 | :inv/sku | :db.type/string | :db.cardinality/one |
| 76 | :inv/type | :db.type/keyword | :db.cardinality/one |
| 79 | :item/count | :db.type/long | :db.cardinality/one |
| 78 | :item/id | :db.type/ref | :db.cardinality/one |
| 77 | :order/items | :db.type/ref | :db.cardinality/many |