Skip to content

Add useAsyncEnumerable option for :many queries - #471

Merged
doron050 merged 3 commits into
mainfrom
claude/brave-allen-p5tsoo
Oct 24, 2026
Merged

doron050 merged 3 commits into
mainfrom
claude/brave-allen-p5tsoo

Conversation

@doron050

Copy link
Copy Markdown
Collaborator

Summary

Adds an opt-in useAsyncEnumerable option (default false). When on, :many methods return IAsyncEnumerable<Row> and stream rows with yield return instead of building a Task<List<Row>>. Output is unchanged when the option is off. Fixes #390.

  • Driver path: yield return straight from the reader, both transaction and no-transaction branches.
  • Dapper path: QueryUnbufferedAsync. It has no CommandDefinition overload, so with withCancellationToken the token is applied via .WithCancellation(token) and only cancels the enumeration, not the in-flight command. This is documented in docs/03_Usage.md.
  • With withCancellationToken, the token parameter is marked [EnumeratorCancellation] and System.Runtime.CompilerServices is added to the usings.
  • netstandard2.0 is rejected (no IAsyncEnumerable).
  • New examples SqliteAsyncEnumerableExample (driver) and NpgsqlDapperAsyncEnumerableExample (Dapper), each with end-to-end tests covering streaming, empty results, transactions and cancellation.

Verified locally

  • make unit-tests: 12 repository and 136 codegen tests pass
  • make sqlc-generate: regenerated output committed and stable on a second run
  • dotnet build of the solution: 0 errors
  • End-to-end tests against Postgres and MySQL (docker) and SQLite: 279 pass
  • make dotnet-format: clean

Not run: the WASM plugin build and sqlc diff against it, and the legacy (net472) tests, which are not affected.

Checklist

  • Generated code is regenerated (make sqlc-generate) and committed
  • Tests added or updated
  • A major / minor / patch label is set (or skip-release for non-release changes) — I can't set labels here; suggest minor

Generated by Claude Code

…ble<Row>

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018VvK2haj1hAvfXx9XWs7Rd
Dapper's QueryUnbufferedAsync has no CommandDefinition overload, so the
Dapper streaming path passes sql/params directly and applies
WithCancellation(token) to the enumeration.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018VvK2haj1hAvfXx9XWs7Rd
@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Release Assistant - Passed

All requirements satisfied.

Release Information:

  • Type: minor

This PR is ready to merge.

@doron050 doron050 added the minor New features or enhancements that are backward compatible. label Oct 24, 2026
@doron050
doron050 merged commit d6c6026 into main Oct 24, 2026
14 checks passed
@doron050
doron050 deleted the claude/brave-allen-p5tsoo branch October 24, 2026 18:53
@github-actions github-actions Bot mentioned this pull request Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor New features or enhancements that are backward compatible.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support IAsyneEnumerable as well as List

2 participants