open DB with SQLITE_OPEN_READ_ONLY

This commit is contained in:
yggverse 2026-03-20 00:03:36 +02:00
parent c317362317
commit 0cbe2a7b04

View file

@ -1,5 +1,5 @@
use chrono::{DateTime, Utc};
use rusqlite::{Connection, Error};
use rusqlite::{Connection, Error, OpenFlags};
use std::path::PathBuf;
pub struct User {
@ -34,7 +34,10 @@ pub struct Database(Connection);
impl Database {
pub fn connect(path: PathBuf) -> Result<Self, Error> {
Ok(Self(Connection::open(path)?))
Ok(Self(Connection::open_with_flags(
path,
OpenFlags::SQLITE_OPEN_READ_ONLY,
)?))
}
pub fn users(&mut self) -> Result<Vec<User>, Error> {