pub struct Database { /* private fields */ }Expand description
Database instance managing collections and storage.
Implementations§
Source§impl Database
impl Database
Sourcepub fn create_collection(
&self,
name: &str,
dimension: usize,
metric: DistanceMetric,
) -> Result<()>
pub fn create_collection( &self, name: &str, dimension: usize, metric: DistanceMetric, ) -> Result<()>
Creates a new collection with the specified parameters.
§Arguments
name- Unique name for the collectiondimension- Vector dimension (e.g., 768 for many embedding models)metric- Distance metric to use for similarity calculations
§Errors
Returns an error if a collection with the same name already exists.
Sourcepub fn create_collection_with_options(
&self,
name: &str,
dimension: usize,
metric: DistanceMetric,
storage_mode: StorageMode,
) -> Result<()>
pub fn create_collection_with_options( &self, name: &str, dimension: usize, metric: DistanceMetric, storage_mode: StorageMode, ) -> Result<()>
Sourcepub fn get_collection(&self, name: &str) -> Option<Collection>
pub fn get_collection(&self, name: &str) -> Option<Collection>
Sourcepub fn list_collections(&self) -> Vec<String>
pub fn list_collections(&self) -> Vec<String>
Lists all collection names in the database.
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
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