Firestore for Rust
Library provides a simple API for Google Firestore based on the official gRPC API:
- Fluent high-level and strongly typed API, the only public API of this library;
- Create or update documents using Rust structures and Serde;
- Support for:
- Querying/streaming docs/objects;
- Listing documents/objects (
stream_allfollows the page tokens for you); - Listening changes from Firestore, with targets added and removed on a running listener and an opt-in idle reset for silent streams;
- Transactions;
- Aggregated queries: count, sum, avg;
- Streaming batch writes with automatic throttling to stay under the Firestore write rate limits;
- K-nearest neighbour (KNN) vector search with Euclidean, Cosine and Dot Product measures;
- Query cursors and partition queries;
- Collection group queries and listing collection IDs;
- Server side document transforms: increment, array append/remove, server timestamp;
- Update/delete preconditions;
- Consistency selectors to read at a given time or inside a transaction;
- Explaining queries: Core queries on the Standard edition, pipelines and SQL on the Enterprise edition;
- Request tags to attribute Firestore usage;
- Opt-in request timeouts;
- On the Enterprise edition of Firestore:
- Pipelines: filters, projections, aggregations, joins and subqueries, unions, nearest neighbours and writes;
- Full-text and geospatial search in pipelines;
- SQL statements in the BigQuery dialect, translated into pipelines, behind an opt-in
sqlfeature; - Unique, dense and one-field indexes, and text and geo search indexes, through index management;
- Full async based on Tokio runtime;
- Macros that help you use your structure fields as Firestore field paths;
- Implements own Serde serializer to Firestore protobuf values;
- Support for multiple database IDs;
- Support for extended datatypes:
- Firestore timestamp as a
FirestoreTimestamptype or with#[serde(with)]attributes (based on jiff); - Lat/Lng;
- References;
- Explicit nulls;
- Firestore timestamp as a
- Caching support for collections and documents, for Core reads and for pipeline and SQL reads:
- In-memory cache;
- Persistent cache;
- Declarative index management behind an opt-in
adminfeature: composite indexes (including one-field, unique and sparse ones), vector indexes, text and geo search indexes, single-field overrides and TTL policy, planned and synced with one call, following the edition of the database; - Bulk delete behind the same
adminfeature: removes every document in named collection groups, at any depth across the whole database, in the background; - Works with the Firestore emulator through
FIRESTORE_EMULATOR_HOST, no credentials needed; - Google client based on gcloud-sdk library that automatically detects GCE environment or application default accounts for local development;