datascript

2022-09-06T19:16:26.809859Z

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?

Niki 2022-09-07T14:27:55.648759Z

The latter

2022-09-07T14:29:53.227769Z

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?

Niki 2022-09-07T14:31:28.728209Z

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

2022-09-07T14:33:58.368509Z

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

Niki 2022-09-07T14:45:32.573119Z

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

2022-09-08T07:54:59.177769Z

๐Ÿ™