Crates.io | firebase-rs |
lib.rs | firebase-rs |
version | 2.2.0 |
source | src |
created_at | 2020-04-27 11:04:07.27605 |
updated_at | 2024-11-20 18:29:12.765506 |
description | Rust based Firebase library |
homepage | |
repository | https://github.com/emreyalvac/firebase-rs |
max_upload_size | |
id | 234618 |
size | 26,678 |
use firebase_rs::*;
let firebase = Firebase::new("https://myfirebase.firebaseio.com").unwrap();
let firebase = Firebase::auth("https://myfirebase.firebaseio.com", "AUTH_KEY").unwrap();
let firebase = Firebase::new("https://myfirebase.firebaseio.com").unwrap().at("users").at("USER_ID").at(...);
let firebase = Firebase::new("https://myfirebase.firebaseio.com").at("users").unwrap();
let stream = firebase.with_realtime_events().unwrap();
stream
.listen( | event_type, data| {
println ! ("Type: {:?} Data: {:?}", event_type, data);
}, | err| println!("{:?}", err), false).await;
let firebase = Firebase::new("https://myfirebase.firebaseio.com").unwrap().at("users");
let users = firebase.get_as_string().await;
#[derive(Serialize, Deserialize, Debug)]
struct User {
name: String
}
let firebase = Firebase::new("https://myfirebase.firebaseio.com").unwrap().at("users");
let user = firebase.get::<HashMap<String, User>> ().await;
#[derive(Serialize, Deserialize, Debug)]
struct User {
name: String
}
let firebase = Firebase::new("https://myfirebase.firebaseio.com").unwrap().at("users").at("USER_ID");
let user = firebase.get::<User>().await;
#[derive(Serialize, Deserialize, Debug)]
struct User {
name: String
}
let user = User { name: String::default () };
let mut firebase = Firebase::new("https://myfirebase.firebaseio.com").unwrap().at("users");
firebase.set_with_key("myKey", &user).await;
Output
{
"users": {
"myKey": {
"name": ""
}
}
}
#[derive(Serialize, Deserialize, Debug)]
struct User {
name: String
}
let user = User { name: String::default () };
let firebase = Firebase::new("https://myfirebase.firebaseio.com").unwrap().at("users");
firebase.set(&user).await;
Output
{
"users": {
"-OC9mYIUIdY3JygkmsFQ": {
"name": ""
}
}
}
#[derive(Serialize, Deserialize, Debug)]
struct User {
name: String
}
let user = User { name: String::default () };
let firebase = Firebase::new("https://myfirebase.firebaseio.com").unwrap().at("users").at("USER_ID");
firebase.update( &user).await;
let firebase = Firebase::new("https://myfirebase.firebaseio.com").unwrap().with_params().start_at(1).order_by("name").equal_to(5).finish();
let result = firebase.get().await;
Thanks goes to these wonderful people ✨