summaryrefslogtreecommitdiff
path: root/dichroism/src/image_repo.rs
diff options
context:
space:
mode:
Diffstat (limited to 'dichroism/src/image_repo.rs')
-rw-r--r--dichroism/src/image_repo.rs32
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(())
+ }
+}