Skip to main content

remem/retrieval/temporal/
types.rs

1/// Time expression parser for temporal-aware retrieval.
2/// Extracts time constraints from queries like "yesterday", "上周", "3 days ago".
3#[derive(Debug, Clone, Copy, PartialEq, Eq)]
4pub struct TemporalConstraint {
5    pub start_epoch: i64,
6    pub end_epoch: i64,
7    pub field: TemporalField,
8}
9
10/// Which time axis the temporal query should use.
11#[derive(Debug, Clone, Copy, PartialEq, Eq)]
12pub enum TemporalField {
13    /// When the remembered fact/event happened.
14    EventTime,
15    /// When the memory row was last changed.
16    UpdatedAt,
17}
18
19impl TemporalField {
20    pub fn as_str(self) -> &'static str {
21        match self {
22            Self::EventTime => "event_time",
23            Self::UpdatedAt => "updated_at_epoch",
24        }
25    }
26}