1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// use entity::store::Entity as StoreEntity;
// use anyhow::Result;
// use std::collections::HashMap;
// use uuid::Uuid;
// /// the table trait allows the operation of curd endpoint on tables
// pub trait Store {
// /// create an instance of the store
// fn new(key:&str, value:&str ) -> Self;
// /// find one by id
// fn find_one(&self,id:&str) -> Result<Self, ()> where Self: Sized;
// /// find all records in the table
// fn find_all() -> Result<Vec<Self>, ()> where Self: Sized;
// ///delete one record in the table
// fn delete_one(&self,id:&str) -> Result<(), ()> where Self: Sized;
// /// delete all records in the table
// fn delete_all() -> Result<(), ()> where Self: Sized;
// /// update a record in the table
// fn update(&self, fields: HashMap<String, String>) -> Result<(), ()> where Self: Sized;
// }
// impl Default for StoreEntity {
// fn default() -> Self {
// StoreEntity::
// }
// }
// impl Store for StoreEntity {
// fn new(key:&str, value:&str) -> Self{
// Self {
// id:
// }
// }
// fn find_one(&self, id: &str) -> Result<Self, ()> where Self: Sized {
// // implementation goes here
// todo!()
// }
// fn find_all() -> Result<Vec<Self>, ()> where Self: Sized {
// // implementation goes here
// todo!()
// }
// fn delete_one(&self, id: &str) -> Result<(), ()> where Self: Sized {
// // implementation goes here
// todo!()
// }
// fn delete_all() -> Result<(), ()> where Self: Sized {
// // implementation goes here
// todo!()
// }
// fn update(&self, fields: HashMap<String, String>) -> Result<(), ()> where Self: Sized {
// // implementation goes here
// todo!()
// }
// }