pub struct Store { /* private fields */ }Expand description
The bookmark store. Wraps a single SQLite connection.
Implementations§
Source§impl Store
impl Store
Sourcepub fn connection(&self) -> &Connection
pub fn connection(&self) -> &Connection
Borrow the underlying connection. Used by tests that need to inspect schema state directly.
Sourcepub fn upsert(&mut self, bookmark: &Bookmark) -> Result<BookmarkId, CoreError>
pub fn upsert(&mut self, bookmark: &Bookmark) -> Result<BookmarkId, CoreError>
Insert or update a bookmark. On canonical-URL collision with a
non-archived row, the existing row’s last_seen_at, title,
description, collection, external_id, and raw are updated and
tags are replaced by the supplied set.
Returns the persisted BookmarkId. The id of the supplied
bookmark is ignored; the canonical URL drives dedupe.
Sourcepub fn by_canonical(
&self,
canonical: &str,
) -> Result<Option<Bookmark>, CoreError>
pub fn by_canonical( &self, canonical: &str, ) -> Result<Option<Bookmark>, CoreError>
Look up a single bookmark by canonical URL. Excludes archived rows.
Sourcepub fn list(
&self,
limit: usize,
offset: usize,
) -> Result<Vec<Bookmark>, CoreError>
pub fn list( &self, limit: usize, offset: usize, ) -> Result<Vec<Bookmark>, CoreError>
List bookmarks paginated, ordered by last_seen_at DESC, id ASC.
Archived rows are excluded.
Sourcepub fn count(&self) -> Result<i64, CoreError>
pub fn count(&self) -> Result<i64, CoreError>
Total number of active bookmarks (excludes archived rows).
Sourcepub fn count_all(&self) -> Result<i64, CoreError>
pub fn count_all(&self) -> Result<i64, CoreError>
Total number of bookmarks including archived tombstones.
Sourcepub fn delete(&mut self, id: &BookmarkId) -> Result<(), CoreError>
pub fn delete(&mut self, id: &BookmarkId) -> Result<(), CoreError>
Soft-delete a bookmark by id. The row remains with archived=1
so re-inserting the same canonical URL is possible without
violating the unique index.
Replace the tag set for a bookmark. Tags are normalized through
Tag::new before insertion; duplicates collapse naturally
(composite PK on (bookmark_id, tag)).
Read all tags attached to a bookmark, sorted alphabetically.