use schemars::JsonSchema;
use crate::segment::data_types::order_by::OrderByInterface;
use crate::segment::types::{Filter, PointIdType, WithPayloadInterface, WithVector};
use serde::{Deserialize, Serialize};
use validator::Validate;
#[derive(Clone, Debug, PartialEq, Hash, Deserialize, Serialize, JsonSchema, Validate)]
#[serde(rename_all = "snake_case")]
pub struct ScrollRequestInternal {
pub offset: Option<PointIdType>,
#[validate(range(min = 1))]
pub limit: Option<usize>,
#[validate(nested)]
pub filter: Option<Filter>,
pub with_payload: Option<WithPayloadInterface>,
#[serde(default, alias = "with_vectors")]
pub with_vector: WithVector,
pub order_by: Option<OrderByInterface>,
}
impl Default for ScrollRequestInternal {
fn default() -> Self {
ScrollRequestInternal {
offset: None,
limit: Some(Self::default_limit()),
filter: None,
with_payload: Some(Self::default_with_payload()),
with_vector: Self::default_with_vector(),
order_by: None,
}
}
}
impl ScrollRequestInternal {
pub const fn default_limit() -> usize {
10
}
pub const fn default_with_payload() -> WithPayloadInterface {
WithPayloadInterface::Bool(true)
}
pub const fn default_with_vector() -> WithVector {
WithVector::Bool(false)
}
}