Skip to content

Commit

Permalink
fill tag database methods
Browse files Browse the repository at this point in the history
  • Loading branch information
LunaeSomnia committed Dec 24, 2023
1 parent 1f3c2f1 commit 4bb7565
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/database/tags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,29 @@ impl DatabaseTagHandler for Database {
}

fn insert_tag(&mut self, tag: Tag) -> Result<(), DatabaseError> {
todo!()
if let Some(connection) = self.get_connection() {
connection.execute(
"INSERT INTO tags (id, name, color) VALUES (?1, ?2, ?3)",
(tag.id, tag.name, tag.color),
)?;
}

Ok(())
}

fn assign_tag_to_audio_file(
&mut self,
tag: TagID,
audio_file: AudioFileID,
) -> Result<(), DatabaseError> {
todo!()
if let Some(connection) = self.get_connection() {
connection.execute(
"INSERT INTO audio_files_tags (audio_file, tags) VALUES (?1, ?2)",
(audio_file, tag),
)?;
}

Ok(())
}
}

Expand Down

0 comments on commit 4bb7565

Please sign in to comment.