pub struct PgVectorStoreBuilder { /* private fields */ }Expand description
Builder for PgVectorStore.
Implementations§
Source§impl PgVectorStoreBuilder
impl PgVectorStoreBuilder
Sourcepub fn with_table(self, table: impl Into<String>) -> Self
pub fn with_table(self, table: impl Into<String>) -> Self
Override the table name. Defaults to entelix_vectors.
Must satisfy SQL-identifier rules
([a-zA-Z_][a-zA-Z0-9_]{0,62}).
Sourcepub const fn with_distance(self, distance: DistanceMetric) -> Self
pub const fn with_distance(self, distance: DistanceMetric) -> Self
Override the distance metric. Defaults to
DistanceMetric::Cosine.
Sourcepub const fn with_index_kind(self, kind: IndexKind) -> Self
pub const fn with_index_kind(self, kind: IndexKind) -> Self
Override the ANN index kind. Defaults to
IndexKind::Hnsw.
Sourcepub const fn with_auto_migrate(self, auto: bool) -> Self
pub const fn with_auto_migrate(self, auto: bool) -> Self
Disable the automatic schema bootstrap.
Pass false when the table + extension + indexes are
provisioned externally (DBA-managed, IaC, migration
pipeline) and the store should consume an existing schema.
Defaults to true.
Sourcepub fn with_connection_string(self, url: impl Into<String>) -> Self
pub fn with_connection_string(self, url: impl Into<String>) -> Self
Connect with a libpq-style connection string. Mutually
exclusive with Self::with_pool.
Sourcepub fn with_pool(self, pool: PgPool) -> Self
pub fn with_pool(self, pool: PgPool) -> Self
Reuse an existing PgPool. Mutually exclusive with
Self::with_connection_string.
Sourcepub const fn with_max_connections(self, max: u32) -> Self
pub const fn with_max_connections(self, max: u32) -> Self
Override the pool’s max_connections (when the builder
constructs the pool). Ignored when Self::with_pool
supplies a pre-built pool.
Sourcepub async fn build(self) -> PgVectorStoreResult<PgVectorStore>
pub async fn build(self) -> PgVectorStoreResult<PgVectorStore>
Finalize the builder. Connects (or adopts the supplied
pool) and runs the schema bootstrap when
auto_migrate=true.
Auto Trait Implementations§
impl Freeze for PgVectorStoreBuilder
impl !RefUnwindSafe for PgVectorStoreBuilder
impl Send for PgVectorStoreBuilder
impl Sync for PgVectorStoreBuilder
impl Unpin for PgVectorStoreBuilder
impl UnsafeUnpin for PgVectorStoreBuilder
impl !UnwindSafe for PgVectorStoreBuilder
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
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>
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>
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