Gijs S.
2016-12-28 18:21:50 UTC
Hi,
With [com.datomic/datomic-pro "0.9.5544"];
Using a string tempid with :db.fn/cas does not work.
With schema:
[{:db/ident :article/slug
:db/valueType :db.type/string
;; identity to enable upsert
:db/unique :db.unique/identity
:db/cardinality :db.cardinality/one}
{:db/ident :article/rev
:db/valueType :db.type/long
:db/cardinality :db.cardinality/one}]
(let [slug "unique_slug"
base-rev nil
next-rev 1
;; with tempid id works
tempid (d/tempid :db.part/user -1)
tx @(d/transact conn
[[:db/add tempid :article/slug slug]
[:db.fn/cas tempid :article/rev base-rev next-rev]])
;; with string-tempid does not work
string-tempid "STRINGID"
tx-two @(d/transact conn
[[:db/add string-tempid :article/slug slug]
[:db.fn/cas string-tempid :article/rev base-rev
next-rev]])
;; IllegalArgumentExceptionInfo :db.error/not-a-keyword Cannot interpret as
a keyword:
;; STRINGID, no leading : datomic.error/deserialize-exception
(error.clj:124)
])
Using this combination of upsert, :db.fn/cas and string tempids also
does not work when using datomic client ([com.datomic/clj-client
"0.8.606"]). And in datomic client there is no alternative to string
tempids.
With [com.datomic/datomic-pro "0.9.5544"];
Using a string tempid with :db.fn/cas does not work.
With schema:
[{:db/ident :article/slug
:db/valueType :db.type/string
;; identity to enable upsert
:db/unique :db.unique/identity
:db/cardinality :db.cardinality/one}
{:db/ident :article/rev
:db/valueType :db.type/long
:db/cardinality :db.cardinality/one}]
(let [slug "unique_slug"
base-rev nil
next-rev 1
;; with tempid id works
tempid (d/tempid :db.part/user -1)
tx @(d/transact conn
[[:db/add tempid :article/slug slug]
[:db.fn/cas tempid :article/rev base-rev next-rev]])
;; with string-tempid does not work
string-tempid "STRINGID"
tx-two @(d/transact conn
[[:db/add string-tempid :article/slug slug]
[:db.fn/cas string-tempid :article/rev base-rev
next-rev]])
;; IllegalArgumentExceptionInfo :db.error/not-a-keyword Cannot interpret as
a keyword:
;; STRINGID, no leading : datomic.error/deserialize-exception
(error.clj:124)
])
Using this combination of upsert, :db.fn/cas and string tempids also
does not work when using datomic client ([com.datomic/clj-client
"0.8.606"]). And in datomic client there is no alternative to string
tempids.
--
You received this message because you are subscribed to the Google Groups "Datomic" group.
To unsubscribe from this group and stop receiving emails from it, send an email to datomic+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Datomic" group.
To unsubscribe from this group and stop receiving emails from it, send an email to datomic+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.