-
Notifications
You must be signed in to change notification settings - Fork 555
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(firestore): Replace usage of Write.transform with Write.update_transforms #8161
fix(firestore): Replace usage of Write.transform with Write.update_transforms #8161
Conversation
41a59c0
to
83c8e14
Compare
An error in my conversion was caught by the server timestamp acceptance test, with output shown below:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a style suggestion, but otherwise this looks good.
4575288
to
ed593ea
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@schmidt-sebastian This PR is ready for your review. Unfortunately there is a lot of noise due to the large number of conformance test file updates, as well as many new style fixes required by the updated linter Rubocop. To make reviewing easier for you, I have called out the four sections of convert.rb
that contain significant changes.
return nil if paths.empty? | ||
paths.map do |field_path, field_value| | ||
to_field_transform field_path, field_value | ||
end.to_a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@schmidt-sebastian Please review lines 163-179 to confirm that the Write
looks correct for a create operation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
) | ||
Google::Cloud::Firestore::V1::Write.new( | ||
update: doc, | ||
update_transforms: field_transforms(field_paths_and_values) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@schmidt-sebastian Please review lines 207-214 to confirm that the Write
looks correct for a set operation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
update: doc, | ||
update_mask: doc_mask, | ||
update_transforms: field_transforms(field_paths_and_values) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@schmidt-sebastian Please review lines 272-283 to confirm that the Write
looks correct for a set merge operation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
update_time: time_to_timestamp(update_time)) | ||
write.current_document = Google::Cloud::Firestore::V1::Precondition.new( | ||
update_time: time_to_timestamp(update_time) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@schmidt-sebastian Please review lines 328-344 to confirm that the Write
looks correct for an update operation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am pretty sure this is correct. It looks like it sends an empty update (with an existing but empty update mask) for a transfom-only update, which is what we want (otherwise it would delete the existing data).
return nil if paths.empty? | ||
paths.map do |field_path, field_value| | ||
to_field_transform field_path, field_value | ||
end.to_a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
) | ||
Google::Cloud::Firestore::V1::Write.new( | ||
update: doc, | ||
update_transforms: field_transforms(field_paths_and_values) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
update: doc, | ||
update_mask: doc_mask, | ||
update_transforms: field_transforms(field_paths_and_values) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
update_time: time_to_timestamp(update_time)) | ||
write.current_document = Google::Cloud::Firestore::V1::Precondition.new( | ||
update_time: time_to_timestamp(update_time) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am pretty sure this is correct. It looks like it sends an empty update (with an existing but empty update mask) for a transfom-only update, which is what we want (otherwise it would delete the existing data).
closes: #8160