This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-08-09
Channels
- # announcements (3)
- # babashka (120)
- # beginners (87)
- # calva (7)
- # clj-kondo (35)
- # cljsrn (25)
- # clojure (94)
- # clojure-austin (4)
- # clojure-europe (53)
- # clojure-nl (2)
- # clojure-norway (6)
- # clojurescript (16)
- # conjure (8)
- # cursive (6)
- # data-oriented-programming (2)
- # data-science (19)
- # datahike (1)
- # datalevin (29)
- # datomic (13)
- # fulcro (50)
- # gratitude (1)
- # honeysql (9)
- # jackdaw (2)
- # kaocha (7)
- # leiningen (3)
- # malli (4)
- # off-topic (4)
- # polylith (3)
- # re-frame (5)
- # reagent (1)
- # releases (1)
- # reveal (4)
- # shadow-cljs (17)
- # tools-deps (10)
- # vim (17)
- # vscode (4)
- # xtdb (3)
i'm trying to use [:db/cas
on a attr that is a db/ident val but i can't use the ident val as a placeholder for the db/id, and cas fails saying it compared my ident keyword with the db/id and they weren't the same. anyone else run into this issue? do i have to do id lookups when using cas like this?
(db/transact db/conn [[:db/cas
17592186048479
:registration.stub/state
:registration.state/pending-principal-acceptance
:registration.state/membership-accepted
]])
{:a :registration.stub/state,
:e 17592186048479,
:v 17592186046002,
:v-old :registration.state/pending-principal-acceptance,
:cognitect.anomalies/category :cognitect.anomalies/conflict,
:cognitect.anomalies/message "Compare failed: :registration.state/pending-principal-acceptance 17592186046002",
:db/error :db.error/cas-failed}
that's what i ended up doing to get cas working, though through pull. i'll use entid instead. i thought i may just be doing something wrong in that case.
Any reason why Datomic does not try to (d/entid) them itself?
I wrote some code in https://github.com/ivarref/double-trouble that handles this: https://github.com/ivarref/double-trouble/blob/main/src/com/github/ivarref/double_trouble.clj#L73 (I didn't document it though.)
many years ago, when datomic had a "suggest a feature" portal, I suggested the feature "support eid/refs in db/cas" and it had some "upvotes".
@ivar.refsdal @pppaul my guess is either performance, or that the ident is a reference (not a value), and refs can change