Skip to content

docs(writer): clarify RowIterator ownership for helper APIs#148

Merged
apstndb merged 3 commits into
mainfrom
docs/issue-144-rowiterator-ownership
Jun 3, 2026
Merged

docs(writer): clarify RowIterator ownership for helper APIs#148
apstndb merged 3 commits into
mainfrom
docs/issue-144-rowiterator-ownership

Conversation

@apstndb

@apstndb apstndb commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • Document that WriteRowIterator and RunRowIterator own the passed *spanner.RowIterator: they consume it, call Stop(), and return RowIteratorResult for post-run metadata and stats.
  • Prefer passing a newly created iterator directly (for example txn.Query(ctx, stmt)) instead of binding iter and defer iter.Stop() at the call site.
  • Clarify that manual Next loops remain different: bind the iterator, defer iter.Stop(), and read metadata or stats only after consuming to iterator.Done.
  • Update writer/README.md examples to use direct txn.Query / txn.QueryWithStats passing.

Fixes #144

Test plan

  • make check

Made with Cursor

Document that WriteRowIterator and RunRowIterator own the passed iterator,
prefer direct txn.Query passing, and return RowIteratorResult for post-run
metadata and stats.

Fixes #144

Co-authored-by: Cursor <cursoragent@cursor.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the documentation in README.md, doc.go, and row_iterator.go to clarify iterator ownership and lifecycle management when using WriteRowIterator and RunRowIterator versus manual loops. The review feedback focuses on improving GoDoc link resolution on pkg.go.dev by using fully qualified paths for external package references (like iterator.Done) and correctly formatting pointer receiver methods with a '*' prefix (like *spanner.RowIterator.Stop).

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread writer/doc.go Outdated
Comment thread writer/row_iterator.go Outdated
Comment thread writer/row_iterator.go Outdated
Comment thread writer/row_iterator.go Outdated
Use fully qualified iterator.Done in doc.go and *-receiver Stop links
in row_iterator godoc so pkg.go.dev resolves external references.

Co-authored-by: Cursor <cursoragent@cursor.com>
@apstndb

apstndb commented Jun 3, 2026

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the documentation in README.md, doc.go, and row_iterator.go to clarify iterator ownership for WriteRowIterator and RunRowIterator, explaining that these helpers manage the lifecycle of the passed iterator. The review feedback suggests using fully qualified package paths for external method links in GoDoc to ensure correct resolution on pkg.go.dev.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread writer/row_iterator.go Outdated
Match pkg.go.dev link style used elsewhere in writer package docs.

Co-authored-by: Cursor <cursoragent@cursor.com>
@apstndb

apstndb commented Jun 3, 2026

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the documentation in README.md, doc.go, and row_iterator.go to clarify iterator ownership for WriteRowIterator and RunRowIterator. It explains that these helpers own the passed iterator, consume it, and call Stop(), and advises callers to pass newly created iterators directly rather than binding them and deferring Stop() at the call site. It also clarifies the expected behavior and usage for manual loops. There are no review comments, and I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@apstndb apstndb merged commit 3831066 into main Jun 3, 2026
2 checks passed
@apstndb apstndb deleted the docs/issue-144-rowiterator-ownership branch June 3, 2026 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: clarify RowIterator ownership for RunRowIterator helpers

1 participant