Path: redb-route/redb.Route.Sql/Batch/BatchItemReader.cs
Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route
Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.Sql/Batch/BatchItemReader.cs
----
using System.Collections;
using System.Runtime.CompilerServices;
namespace redb.Route.Sql.Batch;
///
/// Reads the items of a batch source one at a time, whatever the source is — a list, a lazy sequence, an asynchronous stream.
/// Nothing is read ahead of what the writer asks for, except the first item, which the processor reads before it opens a
/// connection so that an empty source costs none. A failure of the source itself (not of an item's statement) ends the batch:
/// it is reported with the number of items read before it.
///
internal sealed class BatchItemReader : IAsyncDisposable
{
private readonly IAsyncEnumerator