pub struct AlbumSuggestionRepo<'a> { /* private fields */ }Implementations§
Source§impl<'a> AlbumSuggestionRepo<'a>
impl<'a> AlbumSuggestionRepo<'a>
pub fn new(conn: &'a Connection) -> Self
Sourcepub fn insert(
&self,
kind: &str,
title: &str,
photo_ids: &[i64],
cover_photo_id: Option<i64>,
fingerprint: &str,
) -> SqliteResult<i64>
pub fn insert( &self, kind: &str, title: &str, photo_ids: &[i64], cover_photo_id: Option<i64>, fingerprint: &str, ) -> SqliteResult<i64>
Insert a new suggestion. Returns the new row id.
Sourcepub fn get_pending(&self) -> SqliteResult<Vec<AlbumSuggestionRecord>>
pub fn get_pending(&self) -> SqliteResult<Vec<AlbumSuggestionRecord>>
Get all pending suggestions, ordered by newest first.
Sourcepub fn dismiss(&self, id: i64) -> SqliteResult<()>
pub fn dismiss(&self, id: i64) -> SqliteResult<()>
Mark a suggestion as dismissed (will never re-surface due to fingerprint).
Sourcepub fn increment_seen_counts(&self) -> SqliteResult<()>
pub fn increment_seen_counts(&self) -> SqliteResult<()>
Increment seen_count for all pending suggestions by 1. Suggestions with seen_count > 10 are auto-expired to ‘dismissed’.
Sourcepub fn get_all_fingerprints(&self) -> SqliteResult<Vec<String>>
pub fn get_all_fingerprints(&self) -> SqliteResult<Vec<String>>
Get all fingerprints (accepted + dismissed) to avoid re-suggesting.
Sourcepub fn cleanup_old(&self, days: u32) -> SqliteResult<usize>
pub fn cleanup_old(&self, days: u32) -> SqliteResult<usize>
Delete suggestions older than days that are not pending.
Auto Trait Implementations§
impl<'a> Freeze for AlbumSuggestionRepo<'a>
impl<'a> !RefUnwindSafe for AlbumSuggestionRepo<'a>
impl<'a> !Send for AlbumSuggestionRepo<'a>
impl<'a> !Sync for AlbumSuggestionRepo<'a>
impl<'a> Unpin for AlbumSuggestionRepo<'a>
impl<'a> UnsafeUnpin for AlbumSuggestionRepo<'a>
impl<'a> !UnwindSafe for AlbumSuggestionRepo<'a>
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
§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