Enums datomic中的多个枚举
是否可以在datomic中向属性添加多个枚举?比如:Enums datomic中的多个枚举,enums,clojure,datomic,Enums,Clojure,Datomic,是否可以在datomic中向属性添加多个枚举?比如: [{:artist/name "Leonard Cohen" :artist/countries [:country/GR :country/CA] } 在这种情况下,我得到的是 “:db.error/not-an-attribute:country/GR不是属性” 然而 [{:artist/name "Leonard Cohen" :artist/countries :country/GR } 会起作用的请查看。简言之,添
[{:artist/name "Leonard Cohen"
:artist/countries [:country/GR :country/CA] }
在这种情况下,我得到的是
“:db.error/not-an-attribute:country/GR不是属性”
然而
[{:artist/name "Leonard Cohen"
:artist/countries :country/GR }
会起作用的请查看。简言之,添加多个enum
属性时,需要将它们包装在一个集合中,而不是向量中:
; Create some antagonists and load them into the db. We can specify some of the
; attribute-value pairs at the time of creation, and add others later. Note that
; whenever we are adding multiple values for an attribute in a single step (e.g.
; :weapon/type), we must wrap all of the values in a set. Note that the set
; implies there can never be duplicate weapons for any one person. As before,
; we immediately commit the new entities into the DB.
(td/transact *conn*
(td/new-entity { :person/name "James Bond" :location "London" :weapon/type #{ :weapon/gun :weapon/wit } } )
(td/new-entity { :person/name "M" :location "London" :weapon/type #{ :weapon/gun :weapon/guile } } )
(td/new-entity { :person/name "Dr No" :location "Caribbean" :weapon/type :weapon/gun } ))
:artist/countries
属性的架构定义如何?@GuillermoWinkler:[{:db/ident:artist/countries:db/valueType:db.type/ref:db/cardinality:db.cardinality/many