pub struct Database { /* private fields */ }
Implementations§
Source§impl Database
impl Database
pub fn new(client: VectorDBClient, name: String) -> Self
pub fn name(&self) -> &str
pub fn client(&self) -> &VectorDBClient
Sourcepub async fn exists_collection(&self, collection_name: &str) -> Result<bool>
pub async fn exists_collection(&self, collection_name: &str) -> Result<bool>
Check if a collection exists
Sourcepub async fn create_collection(
&self,
name: impl Into<String>,
shard: u32,
replicas: u32,
description: Option<String>,
index: Option<Index>,
embedding: Option<Value>,
ttl_config: Option<Value>,
) -> Result<Collection>
pub async fn create_collection( &self, name: impl Into<String>, shard: u32, replicas: u32, description: Option<String>, index: Option<Index>, embedding: Option<Value>, ttl_config: Option<Value>, ) -> Result<Collection>
Create a new collection
Sourcepub async fn create_collection_if_not_exists(
&self,
name: impl Into<String>,
shard: u32,
replicas: u32,
description: Option<String>,
index: Option<Index>,
embedding: Option<Value>,
ttl_config: Option<Value>,
) -> Result<Collection>
pub async fn create_collection_if_not_exists( &self, name: impl Into<String>, shard: u32, replicas: u32, description: Option<String>, index: Option<Index>, embedding: Option<Value>, ttl_config: Option<Value>, ) -> Result<Collection>
Create a collection if it doesn’t exist
Sourcepub async fn list_collections(&self) -> Result<Vec<Collection>>
pub async fn list_collections(&self) -> Result<Vec<Collection>>
List all collections in the database
Sourcepub async fn collection(
&self,
collection_name: impl Into<String>,
) -> Result<Collection>
pub async fn collection( &self, collection_name: impl Into<String>, ) -> Result<Collection>
Get a collection by name
Sourcepub async fn describe_collection(
&self,
collection_name: impl Into<String>,
) -> Result<Collection>
pub async fn describe_collection( &self, collection_name: impl Into<String>, ) -> Result<Collection>
Describe a collection
Sourcepub async fn drop_collection(
&self,
collection_name: impl Into<String>,
) -> Result<Value>
pub async fn drop_collection( &self, collection_name: impl Into<String>, ) -> Result<Value>
Drop a collection
Sourcepub async fn truncate_collection(
&self,
collection_name: impl Into<String>,
) -> Result<Value>
pub async fn truncate_collection( &self, collection_name: impl Into<String>, ) -> Result<Value>
Truncate a collection (clear all data)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Database
impl !RefUnwindSafe for Database
impl Send for Database
impl Sync for Database
impl Unpin for Database
impl !UnwindSafe for Database
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