Skip to content

Commit

Permalink
Add has vector condition builder
Browse files Browse the repository at this point in the history
  • Loading branch information
timvisee committed Jan 15, 2025
1 parent fc4cf27 commit e5dec4c
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/builders/has_vector_condition_builder.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
use crate::qdrant::*;

pub struct HasVectorConditionBuilder {
pub(crate) vector_name: String,
}

impl HasVectorConditionBuilder {
pub fn new(vector_name: impl Into<String>) -> Self {
Self {
vector_name: vector_name.into(),
}
}

/// Builds the desired type. Can often be omitted.
fn build(self) -> HasVectorCondition {
HasVectorCondition {
has_vector: self.vector_name,
}
}
}

impl From<String> for HasVectorConditionBuilder {
fn from(vector_name: String) -> Self {
Self::new(vector_name)
}
}

impl From<HasVectorConditionBuilder> for HasVectorCondition {
fn from(value: HasVectorConditionBuilder) -> Self {
value.build()
}
}

impl From<String> for HasVectorCondition {
fn from(vector_name: String) -> Self {
HasVectorConditionBuilder::from(vector_name).into()
}
}
3 changes: 3 additions & 0 deletions src/builders/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,6 @@ pub use create_collection_builder::CreateCollectionBuilder;

pub mod count_points_builder;
pub use count_points_builder::*;

pub mod has_vector_condition_builder;
pub use has_vector_condition_builder::HasVectorConditionBuilder;

0 comments on commit e5dec4c

Please sign in to comment.