说我已将:user/name
和:user/gender
安装为数据库架构。
(pprint (d/q '[:find ?ident :where
[?e :db/ident ?ident]
[_ :db.install/attribute ?e]] (d/db conn)))
找到所有db.install / attributes
#{[:db/code] [:user/gender] [:fressian/tag] [:db/unique] [:user/name] [:db/fn]
[:db/noHistory] [:db/fulltext] [:db/lang] [:db/valueType] [:db/doc]
[:db/isComponent] [:db.install/function] [:db/cardinality] [:db/txInstant] [:db/index]}
但是,我只想列出:user namespace
中的项目[:user/gender] [:user/name]
我应该在查询中添加什么,或者是否有自动执行此功能的函数?
答案 0 :(得分:3)
我想通了
(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]}
答案 1 :(得分:1)
您可以使用the Tupelo Datomic library获取给定分区的所有EID。只需使用:
(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) ]
...)
可以在the Datomic Mailing List中找到更多信息。享受!