Some work on interfaces
I'm not happy. It kinda sucks right now. I hope I can fix it~~~~~ But for now I must move to my laptop
This commit is contained in:
parent
62f32da927
commit
9d8fb730ba
8 changed files with 218 additions and 60 deletions
|
|
@ -12,8 +12,8 @@ use sqlx::{
|
|||
};
|
||||
use std::string::ToString;
|
||||
|
||||
pub struct Db<Dbimp: Database> {
|
||||
pool: Pool<Dbimp>
|
||||
pub struct Db<Db: Database> {
|
||||
pool: Pool<Db>
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
|
|
@ -55,45 +55,4 @@ impl Db<Postgres> {
|
|||
Ok(Db { pool })
|
||||
}
|
||||
//
|
||||
// pub async fn add_user(&self, user: &User) -> Result<()> {
|
||||
// query!(r#"
|
||||
// INSERT INTO users(userdid, handle) VALUES ($1, $2)
|
||||
// "#,
|
||||
// user.userdid, user.handle
|
||||
// ).execute(self.pool).await?;
|
||||
// Ok(())
|
||||
// }
|
||||
//
|
||||
// pub async fn add_session(&self, session: &Session) -> Result<()> {
|
||||
// let mut transaction = self.pool.begin().await?;
|
||||
//
|
||||
// query!(r#"
|
||||
// INSERT INTO sessions(sessionuri, label) VALUES ($1, $2)
|
||||
// "#,
|
||||
// session.sessionuri, session.label
|
||||
// ).execute(&mut *transaction).await?;
|
||||
//
|
||||
// for participant in session.participants {
|
||||
// query!(r#"
|
||||
// INSERT INTO participants(sessionuri, userdid, role) VALUES ($1, $2, $3)
|
||||
// "#,
|
||||
// session.sessionuri, participant.userdid, participant.role.to_string()
|
||||
// ).execute(&mut *transaction).await?;
|
||||
// }
|
||||
//
|
||||
// transaction.commit().await
|
||||
// }
|
||||
//
|
||||
// pub async fn add_participant(&self, session: Session,
|
||||
// participant: Participant) -> Result<Session> {
|
||||
// query!(r#"
|
||||
// INSERT INTO participants(sessionuri, userdid, role) VALUES ($1, $2, $3)
|
||||
// "#,
|
||||
// session.sessionuri, participant.userdid, participant.role.to_string()
|
||||
// ).execute(self.pool).await?;
|
||||
//
|
||||
// session.participants.push(participant);
|
||||
//
|
||||
// Ok(session)
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue