()
| 1 | #[tokio::main] |
| 2 | async fn main() { |
| 3 | |
| 4 | // path must be full path for migration::run |
| 5 | let path = "/home/ai/Documents/Rust/blackbird"; |
| 6 | |
| 7 | let storage_name = "blackbird"; |
| 8 | let total_page_size = 1000; |
| 9 | |
| 10 | |
| 11 | |
| 12 | // if storage exist, next time can call migration::run before calling storage::open, |
| 13 | // for update schmea (key, document) |
| 14 | |
| 15 | migration::run(path, |
| 16 | storage_name, |
| 17 | total_page_size, |
| 18 | |rquery: RQuery<Pid, User>| -> RQuery<Pid, User2> { |
| 19 | match rquery { |
| 20 | RQuery::Insert(pid, doc) => { |
| 21 | RQuery::Insert(pid, User2::new(doc.fullname, 23)) |
| 22 | } |
| 23 | RQuery::Remove(pid) => { |
| 24 | RQuery::Remove(pid) |
| 25 | } |
| 26 | } |
| 27 | }); |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | let s = Storage::<Pid, User2>::open(path, storage_name, total_page_size, true).await.unwrap(); |
| 33 | |
| 34 | |
| 35 | } |
| 36 | |
| 37 | |
| 38 | type Pid = String; |
nothing calls this directly
no outgoing calls
no test coverage detected