pub trait VectorExtension {
// Required methods
fn load_vector_extension(&self, path: Option<&Path>) -> Result<()>;
fn vector_init(
&self,
table: &str,
column: &str,
config: VectorConfig,
) -> Result<()>;
fn has_vector_support(&self) -> bool;
fn vector_version(&self) -> Result<String>;
}Expand description
Extend SqliteProjectionStore with vector support
Required Methods§
Sourcefn load_vector_extension(&self, path: Option<&Path>) -> Result<()>
fn load_vector_extension(&self, path: Option<&Path>) -> Result<()>
Load the sqlite-vector extension
§Example
use azoth::prelude::*;
use azoth_vector::VectorExtension;
let db = AzothDb::open("./data")?;
db.projection().load_vector_extension(None)?;Sourcefn vector_init(
&self,
table: &str,
column: &str,
config: VectorConfig,
) -> Result<()>
fn vector_init( &self, table: &str, column: &str, config: VectorConfig, ) -> Result<()>
Initialize a vector column
Must be called after creating the table with a BLOB column.
§Example
use azoth::prelude::*;
use azoth_vector::{VectorExtension, VectorConfig};
// Create table with BLOB column
// Initialize vector columnSourcefn has_vector_support(&self) -> bool
fn has_vector_support(&self) -> bool
Check if vector extension is loaded
§Example
use azoth::prelude::*;
use azoth_vector::VectorExtension;
let db = AzothDb::open("./data")?;
if !db.projection().has_vector_support() {
db.projection().load_vector_extension(None)?;
}Sourcefn vector_version(&self) -> Result<String>
fn vector_version(&self) -> Result<String>
Get the version of the sqlite-vector extension