This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-09-06
Channels
- # announcements (12)
- # asami (3)
- # babashka (59)
- # beginners (20)
- # biff (1)
- # calva (87)
- # cherry (8)
- # clj-kondo (41)
- # clj-together (4)
- # cljdoc (5)
- # cljfx (4)
- # cljs-dev (2)
- # cljsrn (6)
- # clojure (63)
- # clojure-europe (22)
- # clojure-nl (1)
- # clojure-norway (35)
- # clojure-uk (4)
- # clojurescript (5)
- # conjure (2)
- # datalevin (4)
- # datascript (8)
- # datomic (16)
- # events (1)
- # figwheel-main (1)
- # fulcro (9)
- # hyperfiddle (4)
- # introduce-yourself (1)
- # jobs (3)
- # kaocha (10)
- # lambdaisland (2)
- # lumo (7)
- # nbb (1)
- # off-topic (29)
- # pathom (15)
- # re-frame (80)
- # releases (1)
- # remote-jobs (4)
- # shadow-cljs (13)
- # spacemacs (9)
- # sql (25)
- # squint (32)
- # tools-deps (6)
- # uncomplicate (6)
- # xtdb (15)
Hi, is there a way to express in datascript\datomic: retract all entities that satisfy some predicate? or the way is query all relevant id using q and then retract?
I'm guessing it's more relevant to datomic but since we're on the topic: is that mean I can't transact a change that is dependant on some predicate, say: decrease only if availability is > 0?
You can, there are transaction functions. They have to be installed first, if I remember correctly
thanks! I'll read more about it. is there any parallel for datascript?
Yes, but it’s a little more relaxed, since DataScript is always local. So you can just pass fn reference https://github.com/tonsky/datascript/blob/78fdf8ac2666ff013a60460085c64d32f9573d00/test/datascript/test/transact.cljc#L226-L249
You can call them right away with :db.fn/call https://github.com/tonsky/datascript/blob/a6127c4886c93b2c43584fdf57daaeb97cbf86f6/test/datascript/test/transact.cljc#L220