printing sizes added

This commit is contained in:
sreedev
2022-12-27 21:05:41 -05:00
parent 6da2bd401e
commit f8242ca4ac
8 changed files with 372 additions and 22 deletions

View File

@@ -49,20 +49,3 @@ pub fn duplicate_hashes(connection: &sqlite::Connection) -> Result<Vec<File>> {
Ok(result)
}
pub fn lookup(hash: &str) -> Result<Vec<File>> {
let connection = sqlite::open(":memory:")?;
let result_set = connection
.prepare("SELECT * FROM files WHERE hash = ?")?
.into_iter()
.bind((1, hash))?
.map(|row| row.unwrap())
.map(|row| {
let path = row.read::<&str, _>("file_identifier").to_owned();
let hash = row.read::<&str, _>("hash").to_owned();
File { path, hash }
})
.collect::<Vec<File>>();
Ok(result_set)
}