Skip to content

Add ObjectValue #7712

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

Merged
merged 18 commits into from
Mar 18, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Firestore/core/src/model/object_value.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ size_t CalculateSizeOfUnion(
// minus the number of deleted entries.
return upserts.size() +
std::count_if(
map_value->fields, map_value->fields + map_value->fields_count,
map_value.fields, map_value.fields + map_value.fields_count,
[&](const google_firestore_v1_MapValue_FieldsEntry& entry) {
std::string field = MakeString(entry.key);
// Don't count if entry is deleted or if it is a replacement
Expand Down Expand Up @@ -114,10 +114,10 @@ void ApplyChanges(
// Merge the existing data with the deletes and updates
for (pb_size_t source_index = 0, target_index = 0;
target_index < target_count;) {
if (source_index < source_count) {
auto& source_entry = source_fields[source_index];
auto& target_entry = target_fields[target_index];
auto& source_entry = source_fields[source_index];
auto& target_entry = target_fields[target_index];

if (source_index < source_count) {
std::string source_key = MakeString(source_entry.key);

// Check if the source key is deleted
Expand Down
7 changes: 7 additions & 0 deletions Firestore/core/src/nanopb/fields_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "Firestore/Protos/nanopb/google/firestore/v1/document.nanopb.h"
#include "Firestore/Protos/nanopb/google/firestore/v1/firestore.nanopb.h"
#include "Firestore/Protos/nanopb/google/type/latlng.nanopb.h"
#include "Firestore/core/src/nanopb/message.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

This include should no longer be necessary.


namespace firebase {
namespace firestore {
Expand Down Expand Up @@ -132,6 +133,12 @@ inline const pb_field_t* FieldsArray<google_firestore_v1_Value>() {
return google_firestore_v1_Value_fields;
}

template <>
inline const pb_field_t*
FieldsArray<google_firestore_v1_MapValue_FieldsEntry>() {
return google_firestore_v1_MapValue_FieldsEntry_fields;
}

template <>
inline const pb_field_t* FieldsArray<google_firestore_v1_Write>() {
return google_firestore_v1_Write_fields;
Expand Down