15 lines
350 B
Rust
15 lines
350 B
Rust
use std::path::Path;
|
|
|
|
use tokio_rusqlite::{Connection, OpenFlags};
|
|
|
|
pub struct Reader {
|
|
pub connection: Connection,
|
|
}
|
|
|
|
impl Reader {
|
|
pub async fn new(path: &Path) -> Result<Self, tokio_rusqlite::Error> {
|
|
let connection = Connection::open_with_flags(path, OpenFlags::SQLITE_OPEN_READ_ONLY).await?;
|
|
Ok(Self{connection})
|
|
}
|
|
}
|