use r2d2 pool, update rusqlite version

This commit is contained in:
yggverse 2025-03-14 12:27:09 +02:00
parent c3f63dfbdc
commit 33369e31ea
17 changed files with 171 additions and 197 deletions

View file

@ -7,11 +7,10 @@ use database::Database;
use gtk::glib::DateTime;
use item::Item;
use memory::Memory;
use sqlite::{Connection, Transaction};
use std::{
rc::Rc,
sync::{Arc, RwLock},
};
use r2d2::Pool;
use r2d2_sqlite::SqliteConnectionManager;
use sqlite::Transaction;
use std::sync::{Arc, RwLock};
pub struct Bookmark {
database: Database, // permanent storage
@ -22,9 +21,9 @@ impl Bookmark {
// Constructors
/// Create new `Self`
pub fn build(connection: &Rc<RwLock<Connection>>, profile_id: i64) -> Result<Self> {
pub fn build(database_pool: &Pool<SqliteConnectionManager>, profile_id: i64) -> Result<Self> {
// Init children components
let database = Database::new(connection, profile_id);
let database = Database::new(database_pool, profile_id);
let memory = Arc::new(RwLock::new(Memory::new()));
// Build initial index