This also touches atproto/src/lib.rs which may be a problem for the rebase~ Adds migrations and all the other stuff.
39 lines
637 B
Rust
39 lines
637 B
Rust
use std::string::ToString;
|
|
|
|
pub struct Db<Db: Database> {
|
|
pool: Pool<Db>
|
|
}
|
|
|
|
#[non_exhaustive]
|
|
enum Role {
|
|
Owner,
|
|
Participant
|
|
}
|
|
|
|
impl ToString for Role {
|
|
fn to_string(&self) -> String {
|
|
match *self {
|
|
Role::Owner => "owner".to_string(),
|
|
Role::Participant => "participant".to_string(),
|
|
}
|
|
}
|
|
}
|
|
|
|
pub struct Session {
|
|
sessionuri: Uri,
|
|
label: Option<String>,
|
|
participants: Vec<Participant>,
|
|
}
|
|
|
|
impl Db<Postgres> {
|
|
async fn connect() -> Result<Self> {
|
|
|
|
let pool = match PoolOptions::new().connect_with(conn).await {
|
|
Ok(p) => p,
|
|
Err(e) => return Err(e),
|
|
};
|
|
|
|
Ok(Db { pool })
|
|
}
|
|
//
|
|
}
|