qdrant_client/builders/
delete_point_vectors_builder.rs1use crate::grpc_macros::convert_option;
2use crate::qdrant::*;
3
4#[derive(Clone)]
5pub struct DeletePointVectorsBuilder {
6 pub(crate) collection_name: Option<String>,
8 pub(crate) wait: Option<Option<bool>>,
10 points_selector: Option<points_selector::PointsSelectorOneOf>,
12 pub(crate) vectors: Option<Option<VectorsSelector>>,
14 pub(crate) ordering: Option<Option<WriteOrdering>>,
16 pub(crate) shard_key_selector: Option<Option<ShardKeySelector>>,
18}
19
20impl DeletePointVectorsBuilder {
21 #[allow(unused_mut)]
23 pub fn collection_name(self, value: String) -> Self {
24 let mut new = self;
25 new.collection_name = Option::Some(value);
26 new
27 }
28 #[allow(unused_mut)]
30 pub fn wait(self, value: bool) -> Self {
31 let mut new = self;
32 new.wait = Option::Some(Option::Some(value));
33 new
34 }
35 #[allow(unused_mut)]
37 pub fn points_selector<VALUE: core::convert::Into<points_selector::PointsSelectorOneOf>>(
38 self,
39 value: VALUE,
40 ) -> Self {
41 let mut new = self;
42 new.points_selector = Option::Some(value.into());
43 new
44 }
45 #[allow(unused_mut)]
47 pub fn vectors<VALUE: core::convert::Into<VectorsSelector>>(self, value: VALUE) -> Self {
48 let mut new = self;
49 new.vectors = Option::Some(Option::Some(value.into()));
50 new
51 }
52 #[allow(unused_mut)]
54 pub fn ordering<VALUE: core::convert::Into<WriteOrdering>>(self, value: VALUE) -> Self {
55 let mut new = self;
56 new.ordering = Option::Some(Option::Some(value.into()));
57 new
58 }
59 #[allow(unused_mut)]
61 pub fn shard_key_selector<VALUE: core::convert::Into<ShardKeySelector>>(
62 self,
63 value: VALUE,
64 ) -> Self {
65 let mut new = self;
66 new.shard_key_selector = Option::Some(Option::Some(value.into()));
67 new
68 }
69
70 fn build_inner(self) -> Result<DeletePointVectors, DeletePointVectorsBuilderError> {
71 Ok(DeletePointVectors {
72 collection_name: match self.collection_name {
73 Some(value) => value,
74 None => {
75 return Result::Err(core::convert::Into::into(
76 ::derive_builder::UninitializedFieldError::from("collection_name"),
77 ));
78 }
79 },
80 wait: self.wait.unwrap_or_default(),
81 points_selector: { convert_option(&self.points_selector) },
82 vectors: self.vectors.unwrap_or_default(),
83 ordering: self.ordering.unwrap_or_default(),
84 shard_key_selector: self.shard_key_selector.unwrap_or_default(),
85 })
86 }
87 fn create_empty() -> Self {
89 Self {
90 collection_name: core::default::Default::default(),
91 wait: core::default::Default::default(),
92 points_selector: core::default::Default::default(),
93 vectors: core::default::Default::default(),
94 ordering: core::default::Default::default(),
95 shard_key_selector: core::default::Default::default(),
96 }
97 }
98}
99
100impl From<DeletePointVectorsBuilder> for DeletePointVectors {
101 fn from(value: DeletePointVectorsBuilder) -> Self {
102 value.build_inner().unwrap_or_else(|_| {
103 panic!(
104 "Failed to convert {0} to {1}",
105 "DeletePointVectorsBuilder", "DeletePointVectors"
106 )
107 })
108 }
109}
110
111impl DeletePointVectorsBuilder {
112 pub fn build(self) -> DeletePointVectors {
114 self.build_inner().unwrap_or_else(|_| {
115 panic!(
116 "Failed to build {0} into {1}",
117 "DeletePointVectorsBuilder", "DeletePointVectors"
118 )
119 })
120 }
121}
122
123impl DeletePointVectorsBuilder {
124 pub(crate) fn empty() -> Self {
125 Self::create_empty()
126 }
127}
128
129#[non_exhaustive]
131#[derive(Debug)]
132pub enum DeletePointVectorsBuilderError {
133 UninitializedField(&'static str),
135 ValidationError(String),
137}
138
139impl std::fmt::Display for DeletePointVectorsBuilderError {
141 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
142 match self {
143 Self::UninitializedField(field) => {
144 write!(f, "`{field}` must be initialized")
145 }
146 Self::ValidationError(error) => write!(f, "{error}"),
147 }
148 }
149}
150
151impl std::error::Error for DeletePointVectorsBuilderError {}
153
154impl From<derive_builder::UninitializedFieldError> for DeletePointVectorsBuilderError {
156 fn from(error: derive_builder::UninitializedFieldError) -> Self {
157 Self::UninitializedField(error.field_name())
158 }
159}
160
161impl From<String> for DeletePointVectorsBuilderError {
163 fn from(error: String) -> Self {
164 Self::ValidationError(error)
165 }
166}