Commit Graph
76 Commits
Author SHA1 Message Date
Mila 07b7669175 Snapshot listener source from cache (#12370) 2024-03-11 14:53:11 -04:00
Mark Duckworth 54d4d703b6 sum avg (#11650) 2023-10-16 21:10:30 -06:00
Mark Duckworth 45c3004216 Fix: Aggregate query order-by normalization (#11635)
Fix aggregate query order-by normalization to better support future aggregations. This has no affect on count.
2023-08-04 09:55:48 -06:00
Mark Duckworth 52ebbbf19d Sum and average (#11108)
This is implementation but not public release of sum and average. The sum/avg API is not made public. There are no API changes in this PR.
2023-05-12 13:56:16 -06:00
cherylEnkiduandEhsan Nasiri c0e6ac1cf2 Add Public API for Or Query (#10352)
* Add Public API for Or Query

* Add Or query swift tests

* Add Swift tests for IN

* Adding back FIRFirestore+Internal as include file

* Add Documentation

* Address feedback

* Update the changelog.

---------

Co-authored-by: Ehsan Nasiri <ehsann@google.com>
2023-03-06 09:43:06 -08:00
cherylEnkidu 10295bad6b Fix double free bug inside IN Filter (#10535) 2022-11-30 12:52:59 -08:00
cherylEnkidu da7f1dd986 Replace OrderByList by std::vector<OrderBy> (#10402)
* Replace OrderByList by std::vector<OrderBy>

* Remove unordered_set

* Revert "Remove unordered_set"

This reverts commit f9df4691ef62897e48ec6ce80761396e7bdc12ca.
2022-10-26 21:24:29 -04:00
4232ac1d2e Public count (#10254)
* Revert "Revert "Public count (#10246)" (#10252)"

This reverts commit b695d99e91.

* Firestore: Re-write API docs for COUNT API (#10258)

* Add isEqual and hash for aggregate classes (#10261)

Co-authored-by: Denver Coneybeare <dconeybe@google.com>
Co-authored-by: Ehsan <ehsannas@gmail.com>
2022-09-27 18:01:22 -07:00
wu-hui b695d99e91 Revert "Public count (#10246)" (#10252)
This reverts commit 8aae6bee27.
2022-09-23 11:22:05 -04:00
wu-hui 8aae6bee27 Public count (#10246)
* Public Count

* Swift Test Commit

* Swift Format

* No extra whitespace

* Hopefully formatted.

* Change log and feedback.
2022-09-23 11:06:06 -04:00
wu-hui 84a8b5030c Count from server (#10193)
* Proto serialization

* Wire up api

* End to end functional

* Linting

* Add aggregate source

* Fix cmake and style

* Comments, emulators and lints

* Feedback.

* More feedback.
2022-09-14 15:43:35 -07:00
cherylEnkidu 3512851cf6 Implement the Composite Filter class (#9734)
* Implement the Composite Filter class

* Polish code

* add tests for composite filter

* fix broken test

* Improve the implementation of flattern filters

* change the flatten_filters implementation with some other things

* Change the implementation of Filter in Composite Filter

* Address feedback

* Match Android Tests
2022-08-19 14:44:00 -04:00
wu-hui d8bd124e06 Add indexing support to Target (#9519) 2022-04-07 17:02:43 -04:00
cherylEnkidu e6d18641e3 Create FIRFilter in API folder (#9456) 2022-03-18 18:19:16 -04:00
Konstantin Varlamov f243335a25 Don't define a util namespace alias in the global namespace. (#8527)
This would conflict with any definition of a `util` namespace imported from a header. While this applies to other aliases as well, `util` is the one most likely to clash and the one that has actually caused problems.

#no-changelog
2021-09-24 09:11:41 -06:00
Sebastian Schmidt e8f419baf2 Migrate FieldValue to Protobuf (#8124) 2021-07-22 12:44:17 -06:00
Ehsan acc2d15b29 Fix warnings generated by Clang-Tidy (#8181)
* Remove unused namespace alias.

* Remove unused 'using' statements.

* Remove more unused 'using' and namspace aliases.

* Prefer absl::StrContains over comparing `find` result with `npos`.

* Remove more unused things.

* Prefer usage of `empty()` over `size()` when possible.

* Remove more unused things.

* Address code review.

* Address code review.

* More fixes to query_core.cc

* comment should match parameter name.

* Pre-allocate container capacity for better performance.

* More fixes.

* Fix inconsistent declaration parameter name.

* Fix inconsistent declaration parameter name.

* Fix inconsistent declaration parameter name.

* Address bugprone-inaccurate-erase (inappropriate `erase` overload was used).

* Fix return type of move and copy constructor.

* Fix bugprone use after move.

* Fix formatting.

* Reflect the param name change in the doc.
2021-06-04 10:33:43 -05:00
Davis Gossage 3d84b99852 Support NSPredicate CONTAINS and IN with new filter queries (#7203) 2021-01-08 11:53:58 -08:00
Brian Chen 21921e9851 Add != and notIn support (#6418) 2020-09-15 16:12:44 -05:00
Gil 7a58eba2e5 Remove firebase/firestore from paths in Firestore/core (#5374)
* Manual Xcode project fixups

* Remove `firebase/firestore` from paths in Firestore/core

This renames all Firestore files under `Firestore/core` to remove the
interior `firebase/firestore` directory structure. This is motivated by
build failures under Windows where the filenames of intermediates were
too long.

Concretely:

  * `Firebase/core/src/firebase/firestore` becomes `Firebase/core/src`
  * `Firebase/core/test/firebase/firestore` becomes
    `Firebase/core/test/unit`

Moving the tests into a `unit` subdirectory aligns Firestore with the
directory structure in
[AddNewPod](https://github.com/firebase/firebase-ios-sdk/blob/master/AddNewPod.md),
modified for C++ (see discussion in #3224).
2020-04-20 14:57:34 -07:00
Gil 77f92cd2c6 Stop using built-in CMake Framework support (#5316)
* Fix previously unknown warnings

These become visible once flags are handled uniformly across all
Firestore targets in an upcoming build change.

* Stop using built-in CMake Framework support

CMake has built-in support for building Framework bundles (briefly:
bundles of libraries, associated headers, and resources) but this
doesn't work well for our needs.

1. In CMake 3.5.1 (our earliest supported CMake version) it doesn't copy
headers properly at build time.

2. Even up to CMake 3.15.5, CMake doesn't handle link-line multiplicity
correctly. CMake passes the static library location within the framework
and this seems to cause the linker to mishandle Objective-C metaclass
information resulting in duplicate symbols. Building with `-framework`
flags works correctly.

Previously we partially worked around the latter problem by building
some frameworks as shared instead of static frameworks, but this is
problematic because this mode of operation isn't actually intended and
is unsupported as far as the rest of Firebase is concerned. This turned
out to be fragile though and while refactoring libraries this workaround
broke.

Rather than piling on additional workarounds, this change converts the
frameworks to simple library targets and emulates framework imports
through include paths.

Additionally, this starts refactoring our cmake helper functions to make
them more like built-in functions. This makes it possible to freely use
different CMake features that were made difficult by trying to wrap
everything up in a single CMake command.

* style.sh generated changes

* Review feedback

* More review feedback
2020-04-14 08:40:33 -07:00
Gil d9b7a33f0c Use forward declarations instead of IWYU (#4868)
* Remove rarely used template argumnets from SortedMap/SortedSet

* Remove unused STATUS_CHECK_OK

* Rename QuerySnapshot::Listener to QuerySnapshotListener

This makes the type something that can be forward declared.

* Rename DocumentSnapshot::Listener to DocumentSnapshotListener

This makes the type something that can be forward declared.

* Rename ViewSnapshot::Listener to ViewSnapshotListener

This makes the type something that can be forward declared.

* Put most QueryListener implementation in .cc

* Actually use sync_engine_callback.h

* Add forward declaration headers for api, core, and model

These centralize forward declarations, including declarations for some
hard-to-forward-declare types.

* Move includes of hard_assert.h out of other headers

* Make testutil definitions out of line

* Move definitions out-of-line

* Move DocumentKey definitions out-of-line

* Move definitions out-of-line

* Shorten unnecessarily long namespace usages

* Use default destructors where possible

* Delete unused MutationBatch::kUnknown constant

* Use forward declarations instead of IWYU

* Misc fixups from Linux/GCC 9.2.1

* Fix testutil under VS 2017

Forward declarations of functions local to a function body end up
generating unresolved externals. Reduce most of these back to just
calling FieldValue::FromX methods.
2020-02-15 14:34:38 -08:00
Gil 904c1835a5 Prep for forward declarations (#4859)
* Remove rarely used template argumnets from SortedMap/SortedSet

* Remove unused STATUS_CHECK_OK

* Rename QuerySnapshot::Listener to QuerySnapshotListener

This makes the type something that can be forward declared.

* Rename DocumentSnapshot::Listener to DocumentSnapshotListener

This makes the type something that can be forward declared.

* Rename ViewSnapshot::Listener to ViewSnapshotListener

This makes the type something that can be forward declared.

* Put most QueryListener implementation in .cc

* Actually use sync_engine_callback.h
2020-02-10 14:44:10 -08:00
wu-hui 14e28121e2 Release LimitToLast (#4616)
* [1/4] Split Query and Target, and make LocalStore/RemoteStore work with Target. (#4413)

* [2/4]LimitToLast: Make SyncEngine work with Target (#4491)

* [3/4] Implement LimitToLast (#4505)
2020-01-08 09:04:28 -08:00
Gil 9a4f4e73c7 Miscellaneous fixes (#4584)
* Fix use after move in LevelDbPersistenceForTesting

* Fix size-related errors when compiling in 32-bit mode

* Fix test-only memory leaks

* Fix test-only memory leaks

* Prevent spec tests from appearing to leak

The spec tests aren't actually leaking, but they accumulate enough
garbage without clearing the autorelease pool that Instruments
complains.

* Avoid temporaries in methods that @throw

ARC does not release temporaries when an Objective-C exception is
thrown. Use C++ equivalents directly to avoid leaks as detected by
Instruments.

* Fix memory leak in acknowledge mutation

Any previous value must be freed before the next one is assigned.

* Manually implement assignment operators in ByteString

The single by-value implementation wasn't preventing the compiler
generated standard versions from being generated which was causing
leaks.

* Prevent leaking GrpcCompletions that complete after Shutdown

After shutdown, the AsyncQueue silently drops Enqueue requests which
prevents these blocks from being deleted.

* Avoid racing with enqueued operations

It's possible for the Executor to immediately execute the given block,
at which point the block might observe the async queue in a
not-shutting-down state.
2020-01-08 07:11:05 -08:00
Brian Chen 0170957544 Allow querying for arrays in IN queries (#4285) 2019-11-12 13:07:58 -08:00
Morgan Chen 9a611a859d Update header docs based on feedback in cr/278458897 (#4235)
* Update header docs based on feedback in cr/278458897

* Change param names in .mm to match header file
2019-11-05 13:01:45 -08:00
Brian Chen 251a70f26a Make IN queries publicly available (#4174) 2019-10-29 14:13:02 -07:00
Brian Chen 441d7eda8b Change id to NSArray<id> for IN queries (#4182) 2019-10-28 22:22:37 -07:00
Gil cd460eca2d Rationalize input validation exceptions and assertion failures (#4107)
* Rationalize input validation exceptions and assertions

... under a single ThrowHandler concept. This makes it possible to set
an alternative ThrowHandler in our C# bindings that properly translates
input validation exceptions to the correct .NET exception types.

* Rename api/input_validation.h to util/exception.h

* Reimplement util/hard_assert.h in terms of util/exception.h
2019-10-18 12:58:45 -07:00
Brian Chen f7028988b1 Split ListenerRegistration into QueryListenerRegistration (#3832) 2019-09-12 16:44:14 -07:00
wu-hui 7870c73b7c Port FSTFirestoreClient to C++ 2/2 (#3657)
* firestore_client + FSTFirestoreClient becomes delegate.

* fix comment

* addressing comment

* use new instead make_shared

* reformat

* Update references to firestore client

* Addressing comments#2

* addressing comments #3

* add std::move

* remove deleted header.

* fix cmake build error.
2019-08-26 15:48:18 -04:00
Gil 0c23f38397 Migrate Objective-C document types to C++ (#3531)
* Rewrite Document-related classes as a polymorphic value type

* Pass ObjectValue without rvalue references

* Rename HasLocalMutations

* Port C++ users to new Documents

* Port FSTDocumentTests to C++

* Port FSTDocumentSetTests to C++

* Migrate DocumentMap and DocumentSet to C++ Document

* Migrate test helpers

* Delete FSTDocumentSetTests

* Delete FSTDocumentTests

* Mechanical changes to use C++ Document

* Updates to the project file

* Nontrivial test updates

* Remove FSTTestDeletedDoc

* Remove FSTTestUnknownDoc

* Remove FSTDocument

* Convert usage of FSTDocument to C++ Document

* Fix Serializer usage of Documents
2019-08-13 13:59:00 -07:00
Brian Chen 86b09fa469 Add IN and ARRAY_CONTAINS_ANY (not publicly exposed) (#3492) 2019-08-05 11:47:06 -07:00
Gil 13a1b33913 Migrate from FSTQuery to C++ Query (#3484) 2019-08-02 11:35:33 -07:00
Gil 2f22dce569 Reimplement C++ Query with AppendOnlyList (#3483)
* Reimplement C++ Query with AppendOnlyList

* Fix missing assignment to last_document (!!!)

* Refer to filters as std::shared_ptr<const Filter>
2019-08-02 09:14:10 -07:00
Gil bef89668f0 Migrate FSTBound to C++ Bound (#3478)
* Port FSTBound to C++ Bound

* Add limit and Bound to Query

* Migrate FSTBound to C++ Bound, also limits
2019-08-01 12:58:53 -07:00
Gil 561325300b Port FSTSortOrder to C++ OrderBy (#3468)
* Port FSTSortOrder to C++ OrderBy

* Finish port of C++ Direction from Android

* Reimplement FSTSortOrder with C++ OrderBy

* Migrate FSTSortOrder to C++ OrderBy

* Remove FSTSortOrder

* Compare OrderBy equality in C++ Query
2019-07-31 15:39:38 -07:00
Konstantin Varlamov a294e8c112 Remove extraneous imports (#3402)
Remove several imports that appear to be unused.
2019-07-21 17:16:04 -04:00
Gil 10752cd68c Finish migration of FSTFieldValue to C++ FieldValue (#3178)
* Split transform_operations

* Revert "Make ServerTimestamp use FSTFieldValue for previous value"

* Finish FieldValue migration

* Delete FSTFieldValue
2019-06-18 16:21:17 -07:00
Gil 64d8a40a70 Migrate FSTReferenceValue to FSTDelegateValue (#3177)
* Add FieldValue::Reference

* Migrate FSTReferenceValue to FSTDelegateValue

* Build Objective-C components with CMake

Build only the things required for FSTFieldValue
2019-06-14 07:14:18 -07:00
Gil 220589d9bc Port FIRCollectionReference to C++ (#3126)
Also fix up DocumentReference to use it.
2019-06-04 18:10:17 -07:00
Gil dd94ab677f Change limit to an int32 to match the backend (#3120) 2019-05-31 14:10:02 -07:00
Gil 2a263eac83 Port FIRQuery to C++ (#2986) 2019-05-14 14:04:35 -07:00
Michael Lehenbauer a3c5064797 Use shared_ptr<Firestore> instead of Firestore* for api:: classes. (#2830)
This is safer and better matches our design (and the other platforms), since
classes like api::DocumentReference will have references to api::Firsetore but
the lifetime is controlled by the developer, not us.
2019-04-15 09:06:10 -07:00
Gil 7a7eced747 Don't use using statements in Objective-C headers ... (#2827)
use namespace aliases instead.

This makes the Objective-C code much more like what it's going to end up
being like when translated to C++: headers will include classes declared
in a namespace relative to firebase::firestore so everything else will
be named relative to firebase::firestore.

Meanwhile the using statements in the headers were causing us to miss
adding using statements in source files which was moving us away from
where we wanted to be.
2019-04-12 17:03:26 -07:00
Gil 2a97c2ea5f Port FSTRelationFilterOperator to Filter::Operator (#2812)
Note:
  * This includes a partial port of array-contains for Filters because
    this silenced a warning about an unhandled case
  * There's some sensitivity to the order of the cases that I didn't
    bother to figure out; instead I just made it match what came before.
2019-04-11 13:35:09 -07:00
Michael Lehenbauer 09010cfba0 Fix a couple small issues I tripped over today. (#2806)
* Fix a couple small issues I tripped over today.

1. Fix primeBackend so it uses an isolated FIRFirestore* instance. I ran into
   an issue where tests that try to change .settings would fail if they were the
   very first test run, since primeBackend had already configured the client and
   so settings could no longer be changed.
2. Remove FIRFirestore.client and make api::Firestore.client() assert client is configured.
2019-04-11 10:40:56 -07:00
Gil edd4bd719c Port FIRFirestoreSource to C++ Source (#2749) 2019-04-09 07:07:20 -07:00
Gil 2e8b9181fa Port FSTUsageValidation to C++ (#2670)
* Port FSTUsageValidation to C++

* Add an error log level
2019-03-28 13:19:28 -07:00