diff options
author | Adam T. Carpenter <atc@53hor.net> | 2020-10-05 22:05:58 -0400 |
---|---|---|
committer | Adam T. Carpenter <atc@53hor.net> | 2020-10-05 22:05:58 -0400 |
commit | 743ae22168b1fcdf2e1e54bcadbb1bb3fce3370d (patch) | |
tree | 3d393ff1ffd06d1bf470430b2316f46000794806 /dichroism/src/image_repo.rs | |
parent | f8bf353073220ce329d8eb347e3574d5793b6d26 (diff) | |
download | theglassyladies-743ae22168b1fcdf2e1e54bcadbb1bb3fce3370d.tar.xz theglassyladies-743ae22168b1fcdf2e1e54bcadbb1bb3fce3370d.zip |
started work on schema, models, and repos
Diffstat (limited to 'dichroism/src/image_repo.rs')
-rw-r--r-- | dichroism/src/image_repo.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/dichroism/src/image_repo.rs b/dichroism/src/image_repo.rs new file mode 100644 index 0000000..c36f94e --- /dev/null +++ b/dichroism/src/image_repo.rs @@ -0,0 +1,32 @@ +use super::models::ProductImg; +use diesel::prelude::*; +use diesel::result::Error; + +type DBConn = SqliteConnection; + +pub fn read_images(conn: &DBConn) -> Result<Vec<ProductImg>, Error> { + use crate::schema::images::dsl::*; + let results = images.load::<ProductImg>(conn)?; + Ok(results) +} + +pub fn create_image() { + todo!() +} + +pub fn update_image() { + todo!() +} + +pub fn delete_image() { + todo!() +} + +#[cfg(test)] +mod tests { + + #[test] + fn test() -> std::result::Result<(), Box<dyn std::error::Error>> { + Ok(()) + } +} |