pub struct Db {
pool: SqlitePool,
}Fields§
§pool: SqlitePoolImplementations§
Source§impl Db
impl Db
pub fn new(database: &Database) -> Self
pub fn register_library(&self, path: &str, name: &str) -> Result<i64, Error>
pub fn get_library_by_path(&self, path: &str) -> Result<Option<i64>, Error>
fn parse_zoom_mode(json: Option<&String>) -> Option<ZoomMode>
fn parse_scroll_mode(json: Option<&String>) -> Option<ScrollMode>
fn parse_text_align(json: Option<&String>) -> Option<TextAlign>
fn parse_cropping_margins(json: Option<&String>) -> Option<CroppingMargins>
fn parse_page_names(json: Option<&String>) -> BTreeMap<usize, String>
fn parse_bookmarks(json: Option<&String>) -> BTreeSet<usize>
fn parse_annotations(json: Option<&String>) -> Vec<Annotation>
fn parse_page_offset(x: Option<i64>, y: Option<i64>) -> Option<Point>
fn extract_categories(categories: Option<String>) -> BTreeSet<String>
async fn insert_toc_entries( conn: &mut SqliteConnection, book_fingerprint: &str, entries: &[SimpleTocEntry], parent_id: Option<Uuid7>, ) -> Result<(), Error>
async fn fetch_all_toc_entries( pool: &SqlitePool, library_id: i64, ) -> Result<HashMap<String, Vec<TocEntryRow>>, Error>
pub fn get_all_books(&self, library_id: i64) -> Result<Vec<(Fp, Info)>, Error>
pub fn insert_book( &self, library_id: i64, fp: Fp, info: &Info, ) -> Result<(), Error>
pub fn update_book( &self, library_id: i64, fp: Fp, info: &Info, ) -> Result<(), Error>
pub fn delete_reading_state(&self, fp: Fp) -> Result<(), Error>
pub fn delete_book(&self, library_id: i64, fp: Fp) -> Result<(), Error>
pub fn get_thumbnail(&self, fp: Fp) -> Result<Option<Vec<u8>>, Error>
pub fn save_thumbnail(&self, fp: Fp, data: &[u8]) -> Result<(), Error>
pub fn delete_thumbnail(&self, fp: Fp) -> Result<(), Error>
pub fn move_thumbnail(&self, from_fp: Fp, to_fp: Fp) -> Result<(), Error>
pub fn save_reading_state( &self, fp: Fp, reader_info: &ReaderInfo, ) -> Result<(), Error>
pub fn save_toc(&self, fp: Fp, toc: &[SimpleTocEntry]) -> Result<(), Error>
pub fn batch_insert_books( &self, library_id: i64, books: &[(Fp, &Info)], ) -> Result<(), Error>
pub fn batch_update_books( &self, library_id: i64, books: &[(Fp, &Info)], ) -> Result<(), Error>
pub fn batch_delete_books( &self, library_id: i64, fps: &[Fp], ) -> Result<(), Error>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Db
impl !RefUnwindSafe for Db
impl Send for Db
impl Sync for Db
impl Unpin for Db
impl !UnwindSafe for Db
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more