fts_core/models/
datetime.rs

1/// A query type for dealing with datetime ranges
2///
3/// This structure enables API endpoints to accept parameters for filtering results
4/// based on time ranges with optional upper and lower bounds.
5#[derive(Debug, Clone, PartialEq)]
6#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
7#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
8pub struct DateTimeRangeQuery<DateTime> {
9    /// The upper bound (exclusive) for the datetime range
10    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
11    pub before: Option<DateTime>,
12
13    /// The lower bound (inclusive) for the datetime range
14    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
15    pub after: Option<DateTime>,
16}
17
18/// The paginated response to a datetime query
19///
20/// This structure provides a standard format for returning time-based paginated results,
21/// including both the results and pagination metadata for retrieving the next page.
22#[derive(Debug, Clone, PartialEq)]
23#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
24#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
25pub struct DateTimeRangeResponse<T, DateTime> {
26    /// The collection of results matching the query
27    pub results: Vec<T>,
28
29    /// Optional pagination metadata for retrieving the next page of results.
30    /// If present, indicates there are more results available.
31    #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
32    pub more: Option<DateTimeRangeQuery<DateTime>>,
33}