Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add page size parameter to PageAsync with IAsyncEnumerable #457

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,14 @@ ValueTask<IPageQueryResult<TItem>> PageAsync(
/// </summary>
/// <param name="predicate">A filter criteria for the paging operation, if null it will get all <see cref="IItem"/>s</param>
/// <param name="limit">The limit of how many items to yield. Defaults to <c>1,000</c>.</param>
/// <param name="pageSize">The size of the page to return from cosmos db.</param>
/// <param name="cancellationToken">The optional <see cref="CancellationToken"/> used to </param>
/// <returns>An <see cref="IAsyncEnumerable{T}"/> where <c>T</c> is <typeparamref name="TItem"/>.</returns>
/// <remarks>This method makes use of Cosmos DB's continuation tokens for efficient, cost effective paging utilizing low RUs</remarks>
async IAsyncEnumerable<TItem> PageAsync(
Expression<Func<TItem, bool>>? predicate = null,
int limit = 1_000,
int pageSize = 25,
[EnumeratorCancellation] CancellationToken cancellationToken = default)
{
var collected = 0;
Expand All @@ -245,7 +247,7 @@ async IAsyncEnumerable<TItem> PageAsync(
IPageQueryResult<TItem> page = await PageAsync(
predicate,
pageNumber: ++ currentPage,
25,
pageSize,
returnTotal: false,
cancellationToken);

Expand Down
Loading