pub struct Conversations {
pub conversations: Arc<Collection>,
}Expand description
Storage wrapper for the conversations collection.
Fields§
§conversations: Arc<Collection>Underlying AndaDB collection.
Implementations§
Source§impl Conversations
impl Conversations
Sourcepub async fn connect(db: Arc<AndaDB>, name: String) -> Result<Self, BoxError>
pub async fn connect(db: Arc<AndaDB>, name: String) -> Result<Self, BoxError>
Opens or creates the conversations collection and indexes.
Sourcepub async fn add_conversation(
&self,
conversation: ConversationRef<'_>,
) -> Result<u64, DBError>
pub async fn add_conversation( &self, conversation: ConversationRef<'_>, ) -> Result<u64, DBError>
Adds a conversation and flushes the collection.
Sourcepub async fn update_conversation(
&self,
id: u64,
fields: BTreeMap<String, Fv>,
) -> Result<(), DBError>
pub async fn update_conversation( &self, id: u64, fields: BTreeMap<String, Fv>, ) -> Result<(), DBError>
Updates selected conversation fields and flushes the collection.
Sourcepub async fn get_conversation(&self, id: u64) -> Result<Conversation, DBError>
pub async fn get_conversation(&self, id: u64) -> Result<Conversation, DBError>
Retrieves a conversation by ID.
Sourcepub async fn delete_conversation(&self, id: u64) -> Result<bool, DBError>
pub async fn delete_conversation(&self, id: u64) -> Result<bool, DBError>
Deletes a conversation by ID and returns whether it existed.
Sourcepub async fn batch_get_conversations(
&self,
user: &Principal,
ids: Vec<u64>,
) -> Result<Vec<Conversation>, BoxError>
pub async fn batch_get_conversations( &self, user: &Principal, ids: Vec<u64>, ) -> Result<Vec<Conversation>, BoxError>
Retrieves the user’s conversations matching ids.
The underlying query limit is capped at 1000 IDs per call.
Sourcepub async fn list_conversations_by_user(
&self,
user: &Principal,
cursor: Option<String>,
limit: Option<usize>,
) -> Result<(Vec<Conversation>, Option<String>), BoxError>
pub async fn list_conversations_by_user( &self, user: &Principal, cursor: Option<String>, limit: Option<usize>, ) -> Result<(Vec<Conversation>, Option<String>), BoxError>
Lists the user’s conversations, newest first, with cursor-based pagination.
Sourcepub async fn search_conversations(
&self,
user: &Principal,
query: String,
limit: Option<usize>,
) -> Result<Vec<Conversation>, BoxError>
pub async fn search_conversations( &self, user: &Principal, query: String, limit: Option<usize>, ) -> Result<Vec<Conversation>, BoxError>
Searches a user’s conversations with the BM25 conversation index.
Trait Implementations§
Source§impl Clone for Conversations
impl Clone for Conversations
Source§fn clone(&self) -> Conversations
fn clone(&self) -> Conversations
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for Conversations
impl !UnwindSafe for Conversations
impl Freeze for Conversations
impl Send for Conversations
impl Sync for Conversations
impl Unpin for Conversations
impl UnsafeUnpin for Conversations
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> Fruit for T
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