Firestore for Rust
Library provides a simple API for Google Firestore:
- Create or update documents using Rust structures and Serde;
- Support for:
- Querying/streaming docs/objects;
- Listing documents/objects (and auto pages scrolling support);
- Listening changes from Firestore;
- Full async based on Tokio runtime;
- Macro that helps you use JSON paths as references to your structure fields;
- Google client based on gcloud-sdk library that automatically detects GKE environment or application default accounts for local development;
Quick start
Cargo.toml:
[]
= "0.8"
Example code:
// Create an instance
let db = new.await?;
const TEST_COLLECTION_NAME: &'static str = "test";
let my_struct = MyTestStructure ;
// Remove if it already exist
db.delete_by_id.await?;
// Let's insert some data
db.create_obj.await?;
// Update some field in it
let updated_obj = db.update_obj.await?;
println!;
// Get object by id
let find_it_again: MyTestStructure = db.get_obj.await?;
println!;
// Query our data
let objects: = db.query_obj.await?;
println!;
All examples available at examples directory.
To run example use with environment variables:
# PROJECT_ID=<your-google-project-id> cargo run --example simple-crud
Licence
Apache Software License (ASL)
Author
Abdulla Abdurakhmanov