Hello. Can I check if datomic entity have any link on it somewhow? Links may be in a lot or resources so it would be hard to hardcode all the possible attributes to check.
I just want to implement a logic if there are any links I'l mark entity as deleted
(by setting its field) but if there are no links - just retruct it from db
Something like
[:find (count l?)
:where
[?e :worker/id 1018]
[?l _ ?e]]
but this blank doesn't work...wouldn’t the VAET index be a good place?
Possibly yes, I need to read some about it and how to query it
Thanks!
Typo in your find?
I would expect this to work
(Once you fix the typo)
(d/q '[:find ?e :where [_ _ ?e] :in $ ?e] db entity-id)
should work also, I think
I choosed (*seq* (*d/datoms* db :vaet eid))
and seems it works, even for cardinality many attributes
thanks, my shame! it works with typo fix )
hi everyone, what do you think, which way of date comparison is faster in datomic query?
[(.after ^java.util.Date ?exp ^java.util.Date ?now)]
or
[(> ?exp ?now)]
thanks @me1740
I tend to think java typehinted call is faster
but maybe datomic implements it under the hood for >
when used with dates
https://docs.datomic.com/cloud/query/query-data-reference.html#range-predicates
"The predicates `=`, `!=`, `<=`, `<`, `>`, and `>=` are special, in that they take direct advantage of Datomic's AVET index. This makes them much more efficient than equivalent formulations using ordinary predicates."