Fork me on GitHub
#datascript
<
2022-09-06
>
Lidor Cohen19:09:26

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?

Niki14:09:55

The latter

Lidor Cohen14:09:53

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?

Niki14:09:28

You can, there are transaction functions. They have to be installed first, if I remember correctly

Lidor Cohen14:09:58

thanks! I'll read more about it. is there any parallel for datascript?

Niki14:09:32

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