Skip to main content

Store

Struct Store 

Source
pub struct Store { /* private fields */ }
Expand description

The bookmark store. Wraps a single SQLite connection.

Implementations§

Source§

impl Store

Source

pub fn connection(&self) -> &Connection

Borrow the underlying connection. Used by tests that need to inspect schema state directly.

Source

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.

Source

pub fn by_canonical( &self, canonical: &str, ) -> Result<Option<Bookmark>, CoreError>

Look up a single bookmark by canonical URL. Excludes archived rows.

Source

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.

Source

pub fn count(&self) -> Result<i64, CoreError>

Total number of active bookmarks (excludes archived rows).

Source

pub fn count_all(&self) -> Result<i64, CoreError>

Total number of bookmarks including archived tombstones.

Source

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.

Source

pub fn set_tags( &mut self, id: &BookmarkId, tags: &[String], ) -> Result<(), CoreError>

Replace the tag set for a bookmark. Tags are normalized through Tag::new before insertion; duplicates collapse naturally (composite PK on (bookmark_id, tag)).

Source

pub fn tags_for(&self, id: &BookmarkId) -> Result<Vec<String>, CoreError>

Read all tags attached to a bookmark, sorted alphabetically.

Trait Implementations§

Source§

impl Debug for Store

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Freeze for Store

§

impl !RefUnwindSafe for Store

§

impl !Sync for Store

§

impl !UnwindSafe for Store

§

impl Send for Store

§

impl Unpin for Store

§

impl UnsafeUnpin for Store

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.