pub struct SqliteAnnotationRepository { /* private fields */ }Implementations§
Source§impl SqliteAnnotationRepository
impl SqliteAnnotationRepository
pub fn new(db: Database) -> Self
Sourcepub fn create(&self, annotation: &Annotation) -> Result<(), DbError>
pub fn create(&self, annotation: &Annotation) -> Result<(), DbError>
Insert a new annotation. Caller is responsible for building the
Annotation (see Annotation::new_root / new_reply).
Sourcepub fn get(&self, id: &str) -> Result<Option<Annotation>, DbError>
pub fn get(&self, id: &str) -> Result<Option<Annotation>, DbError>
Fetch an annotation by ID (live rows only).
Sourcepub fn list_by_paper(&self, paper_id: &str) -> Result<Vec<Annotation>, DbError>
pub fn list_by_paper(&self, paper_id: &str) -> Result<Vec<Annotation>, DbError>
All live annotations anchored to a paper (roots + replies).
Sourcepub fn list_replies(&self, parent_id: &str) -> Result<Vec<Annotation>, DbError>
pub fn list_replies(&self, parent_id: &str) -> Result<Vec<Annotation>, DbError>
All live replies to a specific root annotation, ordered oldest-first.
Sourcepub fn update_note(
&self,
id: &str,
note: &str,
color: Option<&str>,
tags: &[String],
) -> Result<(), DbError>
pub fn update_note( &self, id: &str, note: &str, color: Option<&str>, tags: &[String], ) -> Result<(), DbError>
Update mutable fields (note / color / tags). Anchor is updated
separately via update_anchor since it has its own lifecycle.
Sourcepub fn update_anchor(&self, id: &str, anchor: &Anchor) -> Result<(), DbError>
pub fn update_anchor(&self, id: &str, anchor: &Anchor) -> Result<(), DbError>
Persist the resolver’s updated anchor state. Called after
resolve_anchor runs on paper-open.
Sourcepub fn soft_delete(&self, id: &str) -> Result<(), DbError>
pub fn soft_delete(&self, id: &str) -> Result<(), DbError>
Soft-delete — tombstones the row so replies still point at
something, and list_* queries skip it.
Sourcepub fn mark_seen(
&self,
annotation_ids: &[&str],
reader: &str,
) -> Result<(), DbError>
pub fn mark_seen( &self, annotation_ids: &[&str], reader: &str, ) -> Result<(), DbError>
Record that reader has seen the current state of each annotation.
Upserts so repeat calls bump seen_at.
Sourcepub fn mark_thread_seen(
&self,
root_id: &str,
reader: &str,
) -> Result<(), DbError>
pub fn mark_thread_seen( &self, root_id: &str, reader: &str, ) -> Result<(), DbError>
Mark the thread rooted at root_id (root + all live replies) as
seen by reader.
Sourcepub fn list_unread(
&self,
reader: &str,
paper_id: Option<&str>,
) -> Result<Vec<Annotation>, DbError>
pub fn list_unread( &self, reader: &str, paper_id: Option<&str>, ) -> Result<Vec<Annotation>, DbError>
Annotations the reader hasn’t seen since the last modification.
Optional paper_id scopes the query. Uses a LEFT JOIN so rows
with no receipt count as unread; rows whose seen_at is older
than updated_at also count (the annotation changed since last
view).
Trait Implementations§
Source§impl Clone for SqliteAnnotationRepository
impl Clone for SqliteAnnotationRepository
Source§fn clone(&self) -> SqliteAnnotationRepository
fn clone(&self) -> SqliteAnnotationRepository
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more