pub struct DbReader { /* private fields */ }Expand description
Thin wrapper around a rusqlite connection opened read-only against an opencode database.
Implementations§
Source§impl DbReader
impl DbReader
Sourcepub fn open<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn open<P: AsRef<Path>>(path: P) -> Result<Self>
Open the opencode database at path read-only.
pub fn path(&self) -> &Path
Sourcepub fn list_projects(&self) -> Result<Vec<Project>>
pub fn list_projects(&self) -> Result<Vec<Project>>
Enumerate every project. Newest first by time_updated.
pub fn get_project(&self, id: &str) -> Result<Option<Project>>
Sourcepub fn list_sessions(&self, project_id: Option<&str>) -> Result<Vec<Session>>
pub fn list_sessions(&self, project_id: Option<&str>) -> Result<Vec<Session>>
Enumerate sessions, optionally filtered by project id.
Newest first by time_updated.
pub fn get_session(&self, id: &str) -> Result<Option<Session>>
Sourcepub fn list_messages_raw(&self, session_id: &str) -> Result<Vec<Message>>
pub fn list_messages_raw(&self, session_id: &str) -> Result<Vec<Message>>
List raw messages (without parts) for a session in
(time_created ASC, id ASC) order.
Sourcepub fn list_parts_for_message(&self, message_id: &str) -> Result<Vec<Part>>
pub fn list_parts_for_message(&self, message_id: &str) -> Result<Vec<Part>>
List all parts for a message in (time_created ASC, id ASC)
order.
Sourcepub fn list_parts_for_session(&self, session_id: &str) -> Result<Vec<Part>>
pub fn list_parts_for_session(&self, session_id: &str) -> Result<Vec<Part>>
List all parts for an entire session in
(message_id, time_created, id) order. More efficient than
N message queries when you want the whole session.
Sourcepub fn load_session(&self, session_id: &str) -> Result<Session>
pub fn load_session(&self, session_id: &str) -> Result<Session>
Convenience: load a session fully — messages with their parts attached, in order.
Auto Trait Implementations§
impl !Freeze for DbReader
impl !RefUnwindSafe for DbReader
impl Send for DbReader
impl !Sync for DbReader
impl Unpin for DbReader
impl UnsafeUnpin for DbReader
impl !UnwindSafe for DbReader
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