public interface IRunicRowSource<TRow, in TKey> where TKey : notnull The rows of a RunicQueryCollection: an application's database table, HTTP API or in-memory list, read one range at a time.
Type parameters
Remarks
A source orders rows by the query's sort keys and then by key, so that a range is stable. The collection calls it from any thread, possibly concurrently, and cancels a call whose result nobody needs any more. It never calls it in a model turn. RunicQueryableRowSource implements it over an IQueryable with RunicQueryFields.
Methods
CountAsync
ValueTask<int> CountAsync(RunicQuery query, CancellationToken cancellationToken) Counts the rows that match query's filters.
Parameters
queryThe query.
cancellationTokenCancels the count.
IndexOfAsync
ValueTask<int> IndexOfAsync(RunicQuery query, TKey key, CancellationToken cancellationToken) Returns the position of the row with key in query's order, or -1.
Parameters
queryThe query.
keyThe row's key.
cancellationTokenCancels the search.
LoadAsync
ValueTask<RunicRowPage<TRow>> LoadAsync(RunicQuery query, RunicRowRange range, CancellationToken cancellationToken) Loads the rows of range in query's order.
Parameters
queryThe query.
rangeThe rows to load. Fewer rows come back at the end of the list.
cancellationTokenCancels the load.
Returns
The rows, and optionally the number of rows that match the query, such as from COUNT(*) OVER ().
Validate
void Validate(RunicQuery query) Checks that the source can run query before the collection takes it.
Parameters
queryThe query.
Exceptions
ArgumentExceptionThe query names a field or filter the source does not have, or a value it cannot use. The page receives
invalid-input, and the collection keeps its query.
Remarks
The query comes from a page and is untrusted: its field names, custom filter names and values are whatever the page sent. Reject every field, operator and value the source does not support by name, rather than passing them to a database. RunicQueryFields.Validate does so for registered fields.