pub struct SqlitePaperStateRepository { /* private fields */ }Implementations§
Source§impl SqlitePaperStateRepository
impl SqlitePaperStateRepository
pub fn new(db: Database) -> Self
Sourcepub fn get(
&self,
paper_id: &str,
reader: &str,
) -> Result<Option<PaperState>, DbError>
pub fn get( &self, paper_id: &str, reader: &str, ) -> Result<Option<PaperState>, DbError>
Load the state for one paper, or None if nothing is recorded yet.
Sourcepub fn set(&self, state: &PaperState) -> Result<(), DbError>
pub fn set(&self, state: &PaperState) -> Result<(), DbError>
Upsert full state for a (paper, reader) pair.
Sourcepub fn toggle_starred(
&self,
paper_id: &str,
reader: &str,
) -> Result<bool, DbError>
pub fn toggle_starred( &self, paper_id: &str, reader: &str, ) -> Result<bool, DbError>
Toggle starred and return the new value. Creates the row if needed.
Sourcepub fn starred_ids(&self, reader: &str) -> Result<HashSet<String>, DbError>
pub fn starred_ids(&self, reader: &str) -> Result<HashSet<String>, DbError>
Load starred paper IDs for one reader as a HashSet.
Sourcepub fn starred_ids_ordered(&self, reader: &str) -> Result<Vec<String>, DbError>
pub fn starred_ids_ordered(&self, reader: &str) -> Result<Vec<String>, DbError>
Paper IDs starred by reader, ordered by when the star was set
(most recent first). Drives the Queue tab (#48) — a cross-search
aggregator of starred papers. The partial index on
paper_state(starred) WHERE starred = 1 keeps this cheap even
with thousands of rows.
Trait Implementations§
Source§impl Clone for SqlitePaperStateRepository
impl Clone for SqlitePaperStateRepository
Source§fn clone(&self) -> SqlitePaperStateRepository
fn clone(&self) -> SqlitePaperStateRepository
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for SqlitePaperStateRepository
impl !UnwindSafe for SqlitePaperStateRepository
impl Freeze for SqlitePaperStateRepository
impl Send for SqlitePaperStateRepository
impl Sync for SqlitePaperStateRepository
impl Unpin for SqlitePaperStateRepository
impl UnsafeUnpin for SqlitePaperStateRepository
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