Struct ZoteroDb

Source
pub struct ZoteroDb {
    conn: Connection,
}
Expand description

Read-only connection to Zotero’s main SQLite database.

Fields§

§conn: Connection

Implementations§

Source§

impl ZoteroDb

Source

pub fn conn(&self) -> &Connection

Access the underlying SQLite connection (for cross-database queries).

Source

pub fn open(path: &Path) -> Result<Self>

Open the Zotero database in read-only mode.

Source

pub fn item_count(&self) -> Result<i64>

Count non-deleted, substantive items (excludes attachments/notes).

Source

pub fn item_by_key(&self, key: &str) -> Result<Option<ZoteroItem>>

Get an item by its 8-char Zotero key (e.g., “9MS26VH5”).

Source

pub fn search_items( &self, query: &str, limit: usize, ) -> Result<Vec<(i64, String)>>

Search items by title, DOI, or abstract (LIKE query).

This is a brute-force scan (~8ms on 2700 items). For better performance, we could add FTS5, but this is already 100x faster than the BBT RPC path.

Source

pub fn recent_items(&self, limit: usize) -> Result<Vec<(i64, String)>>

Get recently modified items.

Source

pub fn item_metadata(&self, item_id: i64) -> Result<HashMap<String, String>>

Get all metadata fields for an item as a key-value map.

Joins through the EAV schema: itemData → fields + itemDataValues.

Source

pub fn item_creators(&self, item_id: i64) -> Result<Vec<Creator>>

Get creators (authors/editors) for an item, ordered.

Source

pub fn item_tags(&self, item_id: i64) -> Result<Vec<String>>

Get tags for an item.

Source

pub fn collections(&self) -> Result<Vec<Collection>>

List all collections with their hierarchy.

Source

pub fn collection_items( &self, collection_key: &str, limit: usize, ) -> Result<Vec<(i64, String)>>

Get item keys in a collection.

Source

pub fn item_attachments(&self, item_id: i64) -> Result<Vec<Attachment>>

Get attachments for an item, including content hash.

The storage_hash field is an MD5 hash computed by Zotero on import. External tools can use it for content-identity verification and deduplication without Biblion needing to know about consumers.

Source

pub fn item_notes(&self, item_id: i64) -> Result<Vec<String>>

Get HTML notes for an item.

Source

pub fn collection_count(&self) -> Result<i64>

Count collections.

Auto Trait Implementations§

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more