Open
Conversation
Contributor
abr-egn
reviewed
Jul 1, 2024
Contributor
abr-egn
left a comment
There was a problem hiding this comment.
I like the direction this solution is going :) As you can see from the previous attempts, getting this right is nontrivial, so this definitely needs test cases to cover the scenarios mentioned in the previous PR.
| labels: Default::default(), | ||
| } | ||
| } | ||
| fn labels<S: Into<String>>(&mut self, other: impl IntoIterator<Item = S>) { |
Contributor
There was a problem hiding this comment.
I think this would be a little more clear as add_labels.
| fn labels<S: Into<String>>(&mut self, other: impl IntoIterator<Item = S>) { | ||
| self.labels.extend(other.into_iter().map(Into::into)) | ||
| } | ||
| fn result(self) -> Result<InsertManyResult> { |
Contributor
There was a problem hiding this comment.
Similarly, our convention is for consuming methods to be called into_* (so into_result here).
| /// number of document results processed in prior batches | ||
| offset: usize, | ||
| /// if only `inserted_ids` is populated, does not actually represent an error | ||
| maybe_failure: InsertManyError, |
Contributor
There was a problem hiding this comment.
I'd prefer that the difference between okay and error paths be explicit at the type level; changing this to a Result<InsertManyResult, InsertManyError> would do that and also make the result method simpler.
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.
Fixes #1157
Something like
UpdateManyErroris probably similarly afflicted, however I can take a look at that next.It would be good to merge this first to set an example for how to do the rest. (in case some of my flourishes here are deemed unacceptable)