pub(super) const DEFAULT_WINDOW_COLUMN: &str = "updated_at";
#[derive(Debug, Clone, PartialEq, Eq)]
pub(in crate::query) struct WindowClause {
pub kind: &'static str,
pub timestamp_column: String,
pub start_ms: u64,
pub end_ms: u64,
}
impl WindowClause {
pub(super) fn none() -> Self {
Self {
kind: "none",
timestamp_column: String::new(),
start_ms: 0,
end_ms: 0,
}
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub(in crate::query) struct CreateSortedIndex {
pub name: String,
pub collection: String,
pub sort_columns: Vec<(String, String)>,
pub key_column: String,
pub window: WindowClause,
}
#[derive(Debug, Clone, PartialEq)]
pub(in crate::query) enum SortedIndexStatement {
Create(CreateSortedIndex),
Drop {
name: String,
},
Rank {
index: String,
key: Vec<u8>,
},
TopK {
index: String,
k: u32,
},
Range {
index: String,
min: Option<f64>,
max: Option<f64>,
},
Count {
index: String,
},
}