is there a canonical way to grab all idents from a particular datomic namespace?

别来无恙 提交于 2019-12-01 07:02:20

I figured it out

(d/q '[:find ?ident :where
           [?e :db/ident ?ident]
           [_ :db.install/attribute ?e]
           [(.toString ?ident) ?val]
           [(.startsWith ?val ":user")]] (d/db *conn*))

;; => #{[:user/gender] [:user/firstName]}

You can use the Tupelo Datomic library to grab all EIDs for a given partition. Just use:

(ns xyz
  (:require [tupelo.datomic :as td] ...

  ; Create a partition named :people (we could namespace it like :db.part/people if we wished)
  (td/transact *conn* 
    (td/new-partition :people ))

; Find all EID's in the :people partition
(let [people-eids (td/partition-eids *conn* :people) ]
   ...)

More information can be found in the Datomic Mailing List. Enjoy!

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!