RowQueries

interface RowQueries<R : Any>

The query operations of one model, each row decoded as R. A row a policy hides is never returned; a field the schema masks is masked as on the public port.

Inheritors

Functions

Link copied to clipboard
abstract fun <G : Any> aggregate(query: AggregationQuery, groupType: Class<G>): Flow<G>

The groups of query, each decoded as groupType: a class of its groups and metrics, or a Map. Experimental, as the aggregation protocol is.

Link copied to clipboard
inline fun <reified G : Any> RowQueries<*>.aggregate(query: AggregationQuery): Flow<G>

The groups of query decoded as G; see RowQueries.aggregate.

Link copied to clipboard
abstract suspend fun count(query: CountQuery): CountResult

How many rows query matches, bounded by its limit or the budget's count limit.

Link copied to clipboard
abstract suspend fun cursor(query: CursorQuery): CursorPage<R>

One keyset page of the rows query matches, with the cursor of the next one.

Link copied to clipboard
abstract fun list(query: ListQuery): Flow<R>

The rows query matches, at most its limit, or the budget's default list size when it names none (0); read whole within the query's timeout. To read every row of a large result, stream it.

Link copied to clipboard
abstract suspend fun paged(query: PagedQuery): PagedList<R>

One page of the rows query matches, with its total as PagedQuery.total asks.

Link copied to clipboard
abstract suspend fun single(query: SingleQuery): R?

The first row query matches, or null when none does.

Link copied to clipboard
abstract fun stream(query: ListQuery, after: String? = null): Flow<Positioned<R>>

The rows query matches as a resumable stream: read in keyset chunks, each its own query under the store's bulkhead, so no permit is held while the collector works, and bounded by neither the list size nor the budget. Each row comes with its position: the same query streamed again after it goes on strictly after that row, on this node or another. A query whose sort cannot order a cursor streams as list does, under its bounds, its rows without positions, and cannot be resumed (after is then wow.query.invalid); such a query names its limit, or it is refused as wow.query.invalid (stream-not-resumable) rather than stopping unannounced at the default list size.