has() operations with and/or combinators. Filters, sorting, and other Query operations are intentionally not available to ensure efficient incremental updates.
CachedQuery.create {
where { has(Enemy.id) or has(Ally.id) } // Use where as root (only one allowed)
}
class CachedQueryBuilder
CachedQueryBuilder
()
|
Signature
constructor() Returns |
where
(
initializer
)
|
Creates a query using the where DSL block, matching the Query.Companion.where syntax.
This provides a consistent API with Query.Companion.where for familiarity. Only one where block is allowed per query - nested where calls are prevented at compile time.
The result of where has a filter method available, allowing filters to be applied only when where is used.
Example:
CachedQuery.create {
where { has(Enemy.id, Health.id) } // Same as: has(Enemy.id, Health.id)
}
CachedQuery.create {
where { has(Enemy.id) }.filter { by(Enemy.statusData).isEqualTo(Status.ACTIVE) }
}
Signature
fun where(initializer: CachedQueryWhereBuilder.() -> CachedQueryNode): FilteredCachedQueryNode.Unfiltered Parameters
initializer:
Function1
where method, preventing nesting.
Returns
FilteredCachedQueryNode.Unfiltered
filter method for adding filters.
|