Open Gozala opened 6 months ago
After trying to learn what datomic does here I found that I could write query like this
{
select: { ucan },
where: [
...conditions,
not(match([ucan, 'ucan/expiration', _])
.or(match([ucan, 'ucan/expiration', expiration])
.and(expiration.conforms($ => $ > time)))
]
}
perhaps this is good enough and we could instead add sugar for the implicit support e.g. something like
const expiration = attribute('ucan/expiration').implicit(Number.MAX_SAFE_INTEGER)
const query = {
select: { ucan },
where: [
...conditions,
expiration(ucan).conforms($ => $ > time)
]
}
I'm finding a need for optional attributes, more specifically I don't want entity to be filtered out even if it does not have that attribute. Here is an example of what I'm finding myself doing
Basically I introduce an
or
clause that always succeeds. In fact now that I'm writing I'm realizing it's not even doing the right thing because it will succeed even ifexpiration < time
.