9 stable releases

Uses new Rust 2021

2.0.5 Aug 4, 2022
2.0.4 Jul 26, 2022
2.0.1 Dec 22, 2021
2.0.0 Dec 20, 2021
1.0.3 Apr 27, 2020

#96 in Database interfaces

Download history 12/week @ 2022-04-22 29/week @ 2022-04-29 27/week @ 2022-05-06 96/week @ 2022-05-13 27/week @ 2022-05-20 45/week @ 2022-05-27 242/week @ 2022-06-03 10/week @ 2022-06-10 15/week @ 2022-06-17 10/week @ 2022-06-24 13/week @ 2022-07-01 18/week @ 2022-07-08 18/week @ 2022-07-15 87/week @ 2022-07-22 49/week @ 2022-07-29 49/week @ 2022-08-05

208 downloads per month

MIT license

19KB
332 lines

firebase-rs

Crates.io docs.rs License

Rust based Firebase library.

firebase

Full Documentation

Documentation

TODO

How to use

Load library

use firebase_rs::*;

Without Auth

let firebase = Firebase::new("https://myfirebase.firebaseio.com").unwrap();

With Auth

let firebase = Firebase::auth("https://myfirebase.firebaseio.com", "AUTH_KEY").unwrap();

At usage for nested objects

let firebase = Firebase::new("https://myfirebase.firebaseio.com").unwrap().at("users").at("USER_ID").at(...);

Read Data

Read data as string

let firebase = Firebase::new("https://myfirebase.firebaseio.com").unwrap().at("users");
let users = firebase.get_as_string().await;

Read data with generic type (All)

#[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;

Read data with generic type (Single record)

#[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;

Set Data

#[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;

Update Data

#[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;

With Params

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;

Dependencies

~3–12MB
~249K SLoC