unco 0.0.2

Supports working with SurealDB
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use once_cell::sync::Lazy;
use surrealdb::{
    engine::remote::ws::{Client, Ws},
    opt::auth::Database,
    Surreal,
};

pub static DB: Lazy<Surreal<Client>> = Lazy::new(Surreal::init);

pub async fn db_conn(address: &str, credentials: Database<'static>) -> Result<(), anyhow::Error> {
    // Connect to the database
    DB.connect::<Ws>(address).await?;
    // Signin as a namespace, database, or root user
    DB.signin(credentials).await?;
    Ok(())
}