feat(pdo): expose statement rows as a lazy seq (statement-seq)#30
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Wraps the intent of
PDOStatement::getIteratoraspdo/statement-seq: a lazy seq of the statement's remaining rows as maps, fetched one row at a time.Return-shape decision (per #16)
Returning the raw PHP
Iteratorwould force callers intophp/->, and an eager vector would just duplicatefetch-all. Insteadstatement-seqis built onlazy-seq+ the existingfetch, so:it is genuinely lazy -
(first ...)/(take n ...)only fetch what they consume;rows are keywordised maps via
row->map, consistent withfetch/fetch-all(and with a stableFETCH_ASSOC, unlike a raw iterator whose shape depends on the fetch mode).Removed
getIteratorfrom the "Not implemented yet" block insrc/pdo/statement.phel.Tests:
statement-seq-yields-rows-as-maps(full realisation) andstatement-seq-is-lazy-first-only-fetches-head(firstrealises just the head).README API table + CHANGELOG
## [Unreleased]updated.Polish pass: no refactor needed - composes
lazy-seq+fetch+cons, no new state.composer testgreen (49 assertions).Closes #16