qdrant_edge/edge/builders/
scroll_request.rs1use crate::segment::data_types::order_by::OrderByInterface;
7use crate::segment::types::{Filter, PointIdType, WithPayloadInterface, WithVector};
8
9use crate::edge::requests::scroll::ScrollRequest;
10
11#[derive(Clone, Debug)]
15pub struct ScrollRequestBuilder {
16 offset: Option<PointIdType>,
17 limit: Option<usize>,
18 filter: Option<Filter>,
19 with_payload: Option<WithPayloadInterface>,
20 with_vector: WithVector,
21 order_by: Option<OrderByInterface>,
22}
23
24impl ScrollRequestBuilder {
25 pub fn new() -> Self {
26 let ScrollRequest {
27 offset,
28 limit,
29 filter,
30 with_payload,
31 with_vector,
32 order_by,
33 } = ScrollRequest::new();
34 Self {
35 offset,
36 limit,
37 filter,
38 with_payload,
39 with_vector,
40 order_by,
41 }
42 }
43
44 pub fn offset(mut self, offset: PointIdType) -> Self {
45 self.offset = Some(offset);
46 self
47 }
48
49 pub fn limit(mut self, limit: usize) -> Self {
50 self.limit = Some(limit);
51 self
52 }
53
54 pub fn filter(mut self, filter: Filter) -> Self {
55 self.filter = Some(filter);
56 self
57 }
58
59 pub fn with_payload(mut self, with_payload: WithPayloadInterface) -> Self {
60 self.with_payload = Some(with_payload);
61 self
62 }
63
64 pub fn with_vector(mut self, with_vector: WithVector) -> Self {
65 self.with_vector = with_vector;
66 self
67 }
68
69 pub fn order_by(mut self, order_by: OrderByInterface) -> Self {
70 self.order_by = Some(order_by);
71 self
72 }
73
74 pub fn build(self) -> ScrollRequest {
75 let Self {
78 offset,
79 limit,
80 filter,
81 with_payload,
82 with_vector,
83 order_by,
84 } = self;
85 ScrollRequest {
86 offset,
87 limit,
88 filter,
89 with_payload,
90 with_vector,
91 order_by,
92 }
93 }
94}
95
96impl Default for ScrollRequestBuilder {
97 fn default() -> Self {
98 Self::new()
99 }
100}