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> {
DB.connect::<Ws>(address).await?;
DB.signin(credentials).await?;
Ok(())
}