insert builder supports values from iterator #739
Merged
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.
PR Info
Hey again! 👋
The
InsertStatement
builder doesn't seem to support adding a dynamic number of items without breaking the functional pattern exhibited throughout the docs. I went ahead and added a method for it since it was pretty simple and was a nice quality of life feature.Though I've got a PR here, there are a few points that I'd like to ask about:
I'm not sure I've chosen a good name for the function. If you have any suggestions or preferences for a better name, please let me know and I can update the PR.
The method I've added wraps
.values_panic
, but I've not added an equivalent method for wrapping.values
. I wasn't sure what behavior would be expected of such a function, so I figured I should ask first.The two options I see are:
Ok
and early exits on firstErr
.values
returns anErr
, but collects the failing items and their errors so that all failures can be returned. I thought briefly about what this interface might look like but I'm not really sure (not sure if that means it's just a bad idea? 😅 )New Features
values_from_panic
method toInsertStatement
for adding multiple rows at once from something that implementsIntoIterator
.Bug Fixes
Breaking Changes
Changes