Crates.io | ddb |
lib.rs | ddb |
version | 0.0.6 |
source | src |
created_at | 2019-09-30 21:55:37.299828 |
updated_at | 2019-10-23 18:35:17.535596 |
description | Datastore DB - High Level Rust API (with serde support) |
homepage | https://github.com/colbyn/ddb |
repository | https://github.com/colbyn/ddb |
max_upload_size | |
id | 168925 |
size | 119,079 |
Googles Cloud Firestore in Datastore mode - High Level Rust API (with serde support!)
// MODEL
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct TodoItem {
pub name: String,
pub title: String,
}
// MODEL METADATA
impl EntityKey for TodoItem {
fn entity_kind_key() -> String {
String::from("TodoItem")
}
fn entity_name_key(&self) -> String {
self.name.clone()
}
}
// INIT
let db = DatastoreClient::new().unwrap();
let item = TodoItem {
name: String::from("test"),
title: String::from("lorem ipsum")
};
// GO!
db.upsert(item);