In/NotIn operations for generated type predicates
Author: BrysonUrieDaklandCreated Apr 15, 2026Updated Jul 2, 2026
The operations in entql/types.go include some operations but are missing others. Specifically they are missing the "In", "NotIn", "Contains", "NotContains" and other similar operators.
- I have searched the issues of this repository and believe that this is not a duplicate.
Summary
Can we add support for the missing operators? It would make building out privacy rules a bit more convenient.
Motivation
For example, when building the Query Rule to limit a request to only tenants the user has access to we have to do something like:
tenants := context.Tenants(ctx)
tenantsAny := util.Map(tenants, func(t int) any {
return t
})
f.Where(entql.FieldIn(tenant.FieldID, tenantsAny...))It would be nice if instead we were able to do this:
tenants := context.Tenants(ctx)
// This is assuming I have cast f with the WhereID(entql.IntP) predicate
f.WhereID(entql.IntIn(tenantsAny...))Thank you! I would love to implement this if you would like!
Source: ent/ent