-
Notifications
You must be signed in to change notification settings - Fork 124
Firestore COUNT API #1174
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
Firestore COUNT API #1174
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
f58cad4
Firestore COUNT API
tom-andersen 8eec324
Exempt from go/allstar check (#1173)
chkuang-g 3c704e0
Token-changed listeners for iOS AppCheck (#1172)
AlmostMatt 2cb8eb2
[macOS sandbox mode] Application group name mangling for semaphores (…
DellaBitta b59f275
Setup Desktop test workflow that detects C++ SDK breakage caused by i…
sunmou99 33c1831
[Bugfx] Fix Nightly Test Report template (#1181)
sunmou99 40e7025
Reduce number of RewardedAd loads on iOS in CI (#1180)
DellaBitta 2810bef
Firestore COUNT implementation (WIP)
tom-andersen 371b820
Firestore COUNT implementation (WIP)
tom-andersen e19f512
Merge remote-tracking branch 'origin/main' into tomandersen/countAPI
tom-andersen 00570d7
Fix linting
tom-andersen 1f3f40d
Fix linting
tom-andersen bed0cea
Fix linking
tom-andersen eb61c87
Merge remote-tracking branch 'origin/main' into tomandersen/countAPI
tom-andersen e6bb4df
Cleanup
tom-andersen 088560d
Fix release notes
tom-andersen d928ae8
Format
tom-andersen c08a1ba
Fixes from review
tom-andersen dfa4248
Formatting
tom-andersen 94fcdef
Responding to PR comments.
tom-andersen e9502a3
Add Hash
tom-andersen a4d88eb
Add Hash
tom-andersen d2d6d36
Fix copyright year
tom-andersen cedc0e2
Rename
tom-andersen 04eca2e
Format
tom-andersen dc6e00c
Rename
tom-andersen 281d2b5
Fixup constructor/assignment parameter naming.
tom-andersen 398a262
Format
tom-andersen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
/* | ||
* Copyright 2023 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include "firestore/src/include/firebase/firestore/aggregate_query.h" | ||
#include "firestore/src/common/cleanup.h" | ||
#include "firestore/src/common/futures.h" | ||
#include "firestore/src/common/util.h" | ||
#include "firestore/src/include/firebase/firestore/aggregate_query_snapshot.h" | ||
|
||
#if defined(__ANDROID__) | ||
// TODO(tomandersen) #include "firestore/src/android/aggregate_query_android.h" | ||
#else | ||
#include "firestore/src/main/aggregate_query_main.h" | ||
#endif // defined(__ANDROID__) | ||
|
||
namespace firebase { | ||
namespace firestore { | ||
|
||
using CleanupFnAggregateQuery = CleanupFn<AggregateQuery>; | ||
|
||
AggregateQuery::AggregateQuery() {} | ||
|
||
AggregateQuery::AggregateQuery(const AggregateQuery& other) { | ||
if (other.internal_) { | ||
internal_ = new AggregateQueryInternal(*other.internal_); | ||
} | ||
CleanupFnAggregateQuery::Register(this, internal_); | ||
} | ||
|
||
AggregateQuery::AggregateQuery(AggregateQuery&& other) { | ||
CleanupFnAggregateQuery::Unregister(&other, other.internal_); | ||
std::swap(internal_, other.internal_); | ||
CleanupFnAggregateQuery::Register(this, internal_); | ||
} | ||
|
||
AggregateQuery::AggregateQuery(AggregateQueryInternal* internal) | ||
: internal_(internal) { | ||
SIMPLE_HARD_ASSERT(internal != nullptr); | ||
CleanupFnAggregateQuery::Register(this, internal_); | ||
} | ||
|
||
AggregateQuery::~AggregateQuery() { | ||
CleanupFnAggregateQuery::Unregister(this, internal_); | ||
delete internal_; | ||
internal_ = nullptr; | ||
} | ||
|
||
AggregateQuery& AggregateQuery::operator=(const AggregateQuery& other) { | ||
if (this == &other) { | ||
return *this; | ||
} | ||
|
||
CleanupFnAggregateQuery::Unregister(this, internal_); | ||
delete internal_; | ||
if (other.internal_) { | ||
internal_ = new AggregateQueryInternal(*other.internal_); | ||
} else { | ||
internal_ = nullptr; | ||
} | ||
CleanupFnAggregateQuery::Register(this, internal_); | ||
return *this; | ||
} | ||
|
||
AggregateQuery& AggregateQuery::operator=(AggregateQuery&& other) { | ||
if (this == &other) { | ||
return *this; | ||
} | ||
|
||
CleanupFnAggregateQuery::Unregister(&other, other.internal_); | ||
CleanupFnAggregateQuery::Unregister(this, internal_); | ||
delete internal_; | ||
internal_ = other.internal_; | ||
other.internal_ = nullptr; | ||
CleanupFnAggregateQuery::Register(this, internal_); | ||
return *this; | ||
} | ||
|
||
Query AggregateQuery::query() const { | ||
if (!internal_) return {}; | ||
return internal_->query(); | ||
} | ||
|
||
Future<AggregateQuerySnapshot> AggregateQuery::Get( | ||
AggregateSource aggregate_source) const { | ||
if (!internal_) return FailedFuture<AggregateQuerySnapshot>(); | ||
return internal_->Get(aggregate_source); | ||
} | ||
|
||
size_t AggregateQuery::Hash() const { | ||
if (!internal_) return {}; | ||
return internal_->Hash(); | ||
} | ||
|
||
bool operator==(const AggregateQuery& lhs, const AggregateQuery& rhs) { | ||
return EqualityCompare(lhs.internal_, rhs.internal_); | ||
} | ||
|
||
} // namespace firestore | ||
} // namespace firebase |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
/* | ||
* Copyright 2023 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include "firestore/src/include/firebase/firestore/aggregate_query_snapshot.h" | ||
|
||
#include "firestore/src/common/cleanup.h" | ||
#include "firestore/src/common/util.h" | ||
#include "firestore/src/include/firebase/firestore/aggregate_query.h" | ||
|
||
#if defined(__ANDROID__) | ||
// TODO(tomandersen) #include | ||
// "firestore/src/android/aggregate_query_snapshot_android.h" | ||
#else | ||
#include "firestore/src/main/aggregate_query_snapshot_main.h" | ||
#endif // defined(__ANDROID__) | ||
|
||
namespace firebase { | ||
namespace firestore { | ||
|
||
using CleanupFnAggregateQuerySnapshot = CleanupFn<AggregateQuerySnapshot>; | ||
|
||
AggregateQuerySnapshot::AggregateQuerySnapshot() {} | ||
|
||
AggregateQuerySnapshot::AggregateQuerySnapshot( | ||
const AggregateQuerySnapshot& other) { | ||
if (other.internal_) { | ||
internal_ = new AggregateQuerySnapshotInternal(*other.internal_); | ||
} | ||
CleanupFnAggregateQuerySnapshot::Register(this, internal_); | ||
} | ||
|
||
AggregateQuerySnapshot::AggregateQuerySnapshot(AggregateQuerySnapshot&& other) { | ||
CleanupFnAggregateQuerySnapshot::Unregister(&other, other.internal_); | ||
std::swap(internal_, other.internal_); | ||
CleanupFnAggregateQuerySnapshot::Register(this, internal_); | ||
} | ||
|
||
AggregateQuerySnapshot::AggregateQuerySnapshot( | ||
AggregateQuerySnapshotInternal* internal) | ||
: internal_(internal) { | ||
SIMPLE_HARD_ASSERT(internal != nullptr); | ||
CleanupFnAggregateQuerySnapshot::Register(this, internal_); | ||
} | ||
|
||
AggregateQuerySnapshot::~AggregateQuerySnapshot() { | ||
CleanupFnAggregateQuerySnapshot::Unregister(this, internal_); | ||
delete internal_; | ||
internal_ = nullptr; | ||
} | ||
|
||
AggregateQuerySnapshot& AggregateQuerySnapshot::operator=( | ||
const AggregateQuerySnapshot& other) { | ||
if (this == &other) { | ||
return *this; | ||
} | ||
|
||
CleanupFnAggregateQuerySnapshot::Unregister(this, internal_); | ||
delete internal_; | ||
if (other.internal_) { | ||
internal_ = new AggregateQuerySnapshotInternal(*other.internal_); | ||
} else { | ||
internal_ = nullptr; | ||
} | ||
CleanupFnAggregateQuerySnapshot::Register(this, internal_); | ||
return *this; | ||
} | ||
|
||
AggregateQuerySnapshot& AggregateQuerySnapshot::operator=( | ||
AggregateQuerySnapshot&& other) { | ||
if (this == &other) { | ||
return *this; | ||
} | ||
|
||
CleanupFnAggregateQuerySnapshot::Unregister(&other, other.internal_); | ||
CleanupFnAggregateQuerySnapshot::Unregister(this, internal_); | ||
delete internal_; | ||
internal_ = other.internal_; | ||
other.internal_ = nullptr; | ||
CleanupFnAggregateQuerySnapshot::Register(this, internal_); | ||
return *this; | ||
} | ||
|
||
AggregateQuery AggregateQuerySnapshot::query() const { | ||
if (!internal_) return {}; | ||
return internal_->query(); | ||
} | ||
|
||
int64_t AggregateQuerySnapshot::count() const { | ||
if (!internal_) return 0; | ||
return internal_->count(); | ||
} | ||
|
||
bool operator==(const AggregateQuerySnapshot& lhs, | ||
const AggregateQuerySnapshot& rhs) { | ||
return EqualityCompare(lhs.internal_, rhs.internal_); | ||
} | ||
|
||
size_t AggregateQuerySnapshot::Hash() const { | ||
if (!internal_) return {}; | ||
return internal_->Hash(); | ||
} | ||
|
||
} // namespace firestore | ||
} // namespace firebase |
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.