Compare commits
15 Commits
ui-not-edi
...
main
Author | SHA1 | Date |
---|---|---|
rozetko | 77c5d3d3ce | 2 years ago |
rozetko | d099998562 | 2 years ago |
rozetko | abbadbc155 | 2 years ago |
rozetko | fce0f30e9e | 2 years ago |
rozetko | f4226a5245 | 2 years ago |
rozetko | 57854909f9 | 2 years ago |
rozetko | e16410d407 | 2 years ago |
Alexey Velikiy | 5f16e006a8 | 2 years ago |
Alexey Velikiy | 55c0fca371 | 2 years ago |
glitch4347 | aa4008662a | 2 years ago |
Alexey Velikiy | a9d2995281 | 2 years ago |
glitch4347 | eee437d779 | 2 years ago |
Alexey Velikiy | b7fb951590 | 2 years ago |
Alexey Velikiy | ad95c1e49f | 2 years ago |
glitch4347 | f684d8ee6a | 2 years ago |
13 changed files with 97 additions and 38 deletions
@ -0,0 +1,23 @@
|
||||
use std::sync::{Arc, Mutex}; |
||||
|
||||
use rusqlite::{Connection}; |
||||
|
||||
|
||||
pub struct DataService { |
||||
pub analytic_units_connection: Arc<Mutex<Connection>>, |
||||
pub segments_connection: Arc<Mutex<Connection>> |
||||
} |
||||
|
||||
impl DataService { |
||||
pub fn new() -> anyhow::Result<DataService> { |
||||
std::fs::create_dir_all("./data").unwrap(); |
||||
|
||||
let analytic_units_connection = Connection::open("./data/analytic_units.db")?; |
||||
let segments_connection = Connection::open("./data/segments.db")?; |
||||
|
||||
Ok(DataService { |
||||
analytic_units_connection: Arc::new(Mutex::new(analytic_units_connection)), |
||||
segments_connection: Arc::new(Mutex::new(segments_connection)) |
||||
}) |
||||
} |
||||
} |
Loading…
Reference in new issue