firebase-rs

Crates.io docs.rs License

Rust based Firebase library.

firebase

Full Documentation

Documentation

How to use

Load library

rust use firebase_rs::*;

Without Auth

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

With Auth

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

````

At usage for nested objects

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


Read Data

Read data as string

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

Read data with generic type (Single record)

````rust

[derive(Serialize, Deserialize, Debug)]

struct User { name: String }

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

Read data with generic type (All)

````rust

[derive(Serialize, Deserialize, Debug)]

struct User { name: String }

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


Set Data

````rust

[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"); let users = firebase.set(&user).await; ````


Update Data

````rust

[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"); let users = firebase.update(&user).await; ````