Don't replace keyword idents if the underlying field is itself :db.type/keyword.
This is necessary to assert new :db/ident datoms.
This commit is contained in:
parent
a1e3158eac
commit
5d271454ac
2 changed files with 13 additions and 8 deletions
|
@ -335,13 +335,13 @@
|
||||||
true
|
true
|
||||||
(recur (util/conj-in report [:entities] entity) entities))))))
|
(recur (util/conj-in report [:entities] entity) entities))))))
|
||||||
|
|
||||||
(defn maybe-ident->entid [db [op & entity :as orig]]
|
(defn maybe-ident->entid [db [op e a v tx :as orig]]
|
||||||
;; TODO: use something faster than `into` here.
|
(let [e (get (idents db) e e) ;; TODO: use ident, entid here.
|
||||||
(->
|
a (get (idents db) a a)
|
||||||
(into [op] (for [field entity]
|
v (if (ds/kw? (schema db) a) ;; TODO: decide if this is best. We could also check for ref and numeric types.
|
||||||
(get (idents db) field field))) ;; TODO: schema, not db.
|
v
|
||||||
;; (with-meta (get (meta orig) :source {:source orig}))
|
(get (idents db) v v))]
|
||||||
))
|
[op e a v tx]))
|
||||||
|
|
||||||
(defrecord Transaction [db tempids entities])
|
(defrecord Transaction [db tempids entities])
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,10 @@
|
||||||
:cljs [^boolean ref?]) [schema attr]
|
:cljs [^boolean ref?]) [schema attr]
|
||||||
(is-attr? schema attr :db.type/ref))
|
(is-attr? schema attr :db.type/ref))
|
||||||
|
|
||||||
|
(defn #?@(:clj [^Boolean kw?]
|
||||||
|
:cljs [^boolean kw?]) [schema attr]
|
||||||
|
(is-attr? schema attr :db.type/keyword))
|
||||||
|
|
||||||
(defn #?@(:clj [^Boolean component?]
|
(defn #?@(:clj [^Boolean component?]
|
||||||
:cljs [^boolean component?]) [schema attr]
|
:cljs [^boolean component?]) [schema attr]
|
||||||
(is-attr? schema attr :db/isComponent))
|
(is-attr? schema attr :db/isComponent))
|
||||||
|
@ -59,7 +63,8 @@
|
||||||
(= v :db.cardinality/many) [:db.cardinality/many]
|
(= v :db.cardinality/many) [:db.cardinality/many]
|
||||||
(= v :db.unique/identity) [:db/unique :db.unique/identity :db/index]
|
(= v :db.unique/identity) [:db/unique :db.unique/identity :db/index]
|
||||||
(= v :db.unique/value) [:db/unique :db.unique/value :db/index]
|
(= v :db.unique/value) [:db/unique :db.unique/value :db/index]
|
||||||
(= [k v] [:db/index true]) [:db/index]))
|
(= [k v] [:db/index true]) [:db/index]
|
||||||
|
(= k :db/valueType) [v]))
|
||||||
|
|
||||||
(defn- multimap [e m]
|
(defn- multimap [e m]
|
||||||
(reduce
|
(reduce
|
||||||
|
|
Loading…
Reference in a new issue