Skip to content

Commit 8598f29

Browse files
authored
Temporarily remove NamedQuery from the public API (#452)
See b/190545340.
1 parent 7b9742a commit 8598f29

File tree

5 files changed

+0
-94
lines changed

5 files changed

+0
-94
lines changed

firestore/integration_test_internal/src/bundle_test.cc

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -94,25 +94,6 @@ class BundleTest : public FirestoreIntegrationTest {
9494
MapFieldValue{{"k", FieldValue::String("b")},
9595
{"bar", FieldValue::Integer(2)}}));
9696
}
97-
98-
{
99-
Query limit = AwaitResult(db->NamedQuery(kLimitQueryName));
100-
auto limit_snapshot = AwaitResult(limit.Get(Source::kCache));
101-
EXPECT_THAT(
102-
QuerySnapshotToValues(limit_snapshot),
103-
testing::ElementsAre(MapFieldValue{{"k", FieldValue::String("b")},
104-
{"bar", FieldValue::Integer(2)}}));
105-
}
106-
107-
{
108-
Query limit_to_last = AwaitResult(db->NamedQuery(kLimitToLastQueryName));
109-
auto limit_to_last_snapshot =
110-
AwaitResult(limit_to_last.Get(Source::kCache));
111-
EXPECT_THAT(
112-
QuerySnapshotToValues(limit_to_last_snapshot),
113-
testing::ElementsAre(MapFieldValue{{"k", FieldValue::String("a")},
114-
{"bar", FieldValue::Integer(1)}}));
115-
}
11697
}
11798
};
11899

@@ -259,21 +240,6 @@ TEST_F(BundleTest, LoadBundleWithDocumentsAlreadyPulledFromBackend) {
259240
testing::ElementsAre(
260241
MapFieldValue{{"bar", FieldValue::String("newValueA")}},
261242
MapFieldValue{{"bar", FieldValue::String("newValueB")}}));
262-
263-
{
264-
Query limit = AwaitResult(db->NamedQuery(kLimitQueryName));
265-
EXPECT_THAT(QuerySnapshotToValues(AwaitResult(limit.Get(Source::kCache))),
266-
testing::ElementsAre(
267-
MapFieldValue{{"bar", FieldValue::String("newValueB")}}));
268-
}
269-
270-
{
271-
Query limit_to_last = AwaitResult(db->NamedQuery(kLimitToLastQueryName));
272-
EXPECT_THAT(
273-
QuerySnapshotToValues(AwaitResult(limit_to_last.Get(Source::kCache))),
274-
testing::ElementsAre(
275-
MapFieldValue{{"bar", FieldValue::String("newValueA")}}));
276-
}
277243
}
278244

279245
TEST_F(BundleTest, LoadedDocumentsShouldNotBeGarbageCollectedRightAway) {
@@ -316,28 +282,6 @@ TEST_F(BundleTest, LoadDocumentsFromOtherProjectsShouldFail) {
316282
VerifyErrorProgress(progresses[1]);
317283
}
318284

319-
TEST_F(BundleTest, GetInvalidNamedQuery) {
320-
Firestore* db = TestFirestore();
321-
{
322-
auto future = db->NamedQuery("DOES_NOT_EXIST");
323-
Await(future);
324-
EXPECT_EQ(future.status(), FutureStatus::kFutureStatusComplete);
325-
EXPECT_EQ(future.error(), Error::kErrorNotFound);
326-
}
327-
{
328-
auto future = db->NamedQuery("");
329-
Await(future);
330-
EXPECT_EQ(future.status(), FutureStatus::kFutureStatusComplete);
331-
EXPECT_EQ(future.error(), Error::kErrorNotFound);
332-
}
333-
{
334-
auto future = db->NamedQuery("\xc3\x28");
335-
Await(future);
336-
EXPECT_EQ(future.status(), FutureStatus::kFutureStatusComplete);
337-
EXPECT_EQ(future.error(), Error::kErrorNotFound);
338-
}
339-
}
340-
341285
} // namespace
342286
} // namespace firestore
343287
} // namespace firebase

firestore/src/common/firestore.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -343,10 +343,5 @@ Future<LoadBundleTaskProgress> Firestore::LoadBundle(
343343
return internal_->LoadBundle(bundle, std::move(progress_callback));
344344
}
345345

346-
Future<Query> Firestore::NamedQuery(const std::string& query_name) {
347-
if (!internal_) return FailedFuture<Query>();
348-
return internal_->NamedQuery(query_name);
349-
}
350-
351346
} // namespace firestore
352347
} // namespace firebase

firestore/src/include/firebase/firestore.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -429,21 +429,6 @@ class Firestore {
429429
const std::string& bundle,
430430
std::function<void(const LoadBundleTaskProgress&)> progress_callback);
431431

432-
/**
433-
* Reads a Firestore `Query` from the local cache, identified by the given
434-
* name.
435-
*
436-
* Named queries are packaged into bundles on the server side (along with the
437-
* resulting documents) and loaded into local cache using `LoadBundle`. Once
438-
* in the local cache, you can use this method to extract a query by name.
439-
*
440-
* If a query cannot be found, the returned future will complete with its
441-
* `error()` set to a non-zero error code.
442-
*
443-
* @param query_name The name of the query to read from saved bundles.
444-
*/
445-
virtual Future<Query> NamedQuery(const std::string& query_name);
446-
447432
protected:
448433
/**
449434
* Default constructor, to be used only for mocking `Firestore`.

firestore/src/main/firestore_main.cc

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -378,22 +378,5 @@ Future<LoadBundleTaskProgress> FirestoreInternal::LoadBundle(
378378
return promise.future();
379379
}
380380

381-
Future<Query> FirestoreInternal::NamedQuery(const std::string& query_name) {
382-
auto promise = promise_factory_.CreatePromise<Query>(AsyncApi::kNamedQuery);
383-
firestore_core_->GetNamedQuery(
384-
query_name,
385-
[this, promise](const absl::optional<core::Query>& query) mutable {
386-
if (query.has_value()) {
387-
promise.SetValue(
388-
MakePublic(api::Query(query.value(), firestore_core_)));
389-
} else {
390-
promise.SetError(
391-
Status(Error::kErrorNotFound, "Named query cannot be found"));
392-
}
393-
});
394-
395-
return promise.future();
396-
}
397-
398381
} // namespace firestore
399382
} // namespace firebase

firestore/src/main/firestore_main.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ class FirestoreInternal {
100100
Future<LoadBundleTaskProgress> LoadBundle(
101101
const std::string& bundle,
102102
std::function<void(const LoadBundleTaskProgress&)> progress_callback);
103-
Future<Query> NamedQuery(const std::string& query_name);
104103

105104
// Manages the ListenerRegistrationInternal objects.
106105
void RegisterListenerRegistration(ListenerRegistrationInternal* registration);

0 commit comments

Comments
 (0)