trying to tweak sqlx
This commit is contained in:
parent
4fe68236ea
commit
804850505e
11 changed files with 129 additions and 219 deletions
|
@ -374,6 +374,24 @@ pub async fn get_song_from_db(
|
|||
}
|
||||
|
||||
impl Model<Song> {
|
||||
pub async fn update_song(
|
||||
&mut self,
|
||||
item: Song,
|
||||
index: i32,
|
||||
db: &mut SqliteConnection,
|
||||
) -> Result<()> {
|
||||
self.update_item(item, index)?;
|
||||
|
||||
query!(
|
||||
r#"UPDATE songs SET title = {} WHERE id = {}"#,
|
||||
item.title,
|
||||
item.id
|
||||
)
|
||||
.fetch_one(db)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
pub async fn new_song_model(db: &mut SqliteConnection) -> Self {
|
||||
let mut model = Self {
|
||||
items: vec![],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue