mirror of
https://github.com/stoatchat/stoatchat.git
synced 2026-07-14 05:26:59 +00:00
Run rust fmt.
This commit is contained in:
@@ -1,30 +1,30 @@
|
||||
use mongodb::{ Client, Collection, Database };
|
||||
use mongodb::{Client, Collection, Database};
|
||||
use std::env;
|
||||
|
||||
use once_cell::sync::OnceCell;
|
||||
static DBCONN: OnceCell<Client> = OnceCell::new();
|
||||
|
||||
pub fn connect() {
|
||||
let client = Client::with_uri_str(
|
||||
&env::var("DB_URI").expect("DB_URI not in environment variables!"))
|
||||
.expect("Failed to init db connection.");
|
||||
let client =
|
||||
Client::with_uri_str(&env::var("DB_URI").expect("DB_URI not in environment variables!"))
|
||||
.expect("Failed to init db connection.");
|
||||
|
||||
DBCONN.set(client).unwrap();
|
||||
DBCONN.set(client).unwrap();
|
||||
}
|
||||
|
||||
pub fn get_connection() -> &'static Client {
|
||||
DBCONN.get().unwrap()
|
||||
DBCONN.get().unwrap()
|
||||
}
|
||||
|
||||
pub fn get_db() -> Database {
|
||||
get_connection().database("revolt")
|
||||
get_connection().database("revolt")
|
||||
}
|
||||
|
||||
pub fn get_collection(collection: &str) -> Collection {
|
||||
get_db().collection(collection)
|
||||
get_db().collection(collection)
|
||||
}
|
||||
|
||||
pub mod user;
|
||||
pub mod channel;
|
||||
pub mod message;
|
||||
pub mod guild;
|
||||
pub mod message;
|
||||
pub mod user;
|
||||
|
||||
Reference in New Issue
Block a user