New cache
()
| 390 | |
| 391 | /// New cache |
| 392 | pub fn new() -> Result<Self, Error> { |
| 393 | let conf = Config::locate()?; |
| 394 | let mut c = conn(conf.storage.cache()?); |
| 395 | diesel::sql_query(CREATE_PROBLEMS_IF_NOT_EXISTS).execute(&mut c)?; |
| 396 | diesel::sql_query(CREATE_TAGS_IF_NOT_EXISTS).execute(&mut c)?; |
| 397 | |
| 398 | Ok(Cache(LeetCode::new()?)) |
| 399 | } |
| 400 | } |