pub struct DatabaseWorker { /* private fields */ }Implementations§
Source§impl DatabaseWorker
impl DatabaseWorker
pub fn new(shared_state: Arc<SharedState>) -> Self
Sourcepub async fn store_messages(
&self,
session_id: String,
messages: Vec<Message>,
) -> Result<()>
pub async fn store_messages( &self, session_id: String, messages: Vec<Message>, ) -> Result<()>
Store messages in database
Sourcepub async fn get_conversation(
&self,
session_id: &str,
) -> Result<Vec<StoredMessage>>
pub async fn get_conversation( &self, session_id: &str, ) -> Result<Vec<StoredMessage>>
Retrieve conversation from database
Sourcepub async fn update_conversation_title(
&self,
session_id: &str,
title: &str,
) -> Result<()>
pub async fn update_conversation_title( &self, session_id: &str, title: &str, ) -> Result<()>
Update conversation title
Sourcepub async fn delete_conversation(&self, session_id: &str) -> Result<()>
pub async fn delete_conversation(&self, session_id: &str) -> Result<()>
Delete conversation
Sourcepub async fn begin_transaction(&self) -> Result<Transaction<'_>>
pub async fn begin_transaction(&self) -> Result<Transaction<'_>>
Begin database transaction
Sourcepub async fn get_stats(&self) -> Result<DatabaseStats>
pub async fn get_stats(&self) -> Result<DatabaseStats>
Get database statistics
Sourcepub async fn cleanup_old_data(&self, older_than_days: i32) -> Result<usize>
pub async fn cleanup_old_data(&self, older_than_days: i32) -> Result<usize>
Cleanup old data
Auto Trait Implementations§
impl Freeze for DatabaseWorker
impl !RefUnwindSafe for DatabaseWorker
impl Send for DatabaseWorker
impl Sync for DatabaseWorker
impl Unpin for DatabaseWorker
impl UnsafeUnpin for DatabaseWorker
impl !UnwindSafe for DatabaseWorker
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more