pub struct BitemporalRecord<T = ()> {
pub id: RecordId,
pub valid_time: DateTime<Utc>,
pub recorded_time: DateTime<Utc>,
pub value: T,
}Expand description
A bitemporal record.
Type parameter T is the domain value being recorded.
The record carries two orthogonal timelines:
valid_time: when the value is true in the domain (business time)recorded_time: when the system captured the value (system time)
Fields§
§id: RecordIdUnique identifier for this record (stable across versions). Used to link superseding records.
valid_time: DateTime<Utc>Valid time — when this record’s value is true in the domain. Backward-bounded (valid_time is set to the moment the fact became true).
recorded_time: DateTime<Utc>Recorded time — when this record was inserted into the system. Forward-bounded (recorded_time is the moment of system insertion).
value: TThe domain value this record captures. Defaults to T::default()
when missing from the wire format — both with and without the
schema feature. The schema feature adds T: Default to the
schemars bound, which is also the bound serde(default) requires.
Implementations§
Source§impl<T> BitemporalRecord<T>
impl<T> BitemporalRecord<T>
Sourcepub fn map<U>(self, f: impl FnOnce(T) -> U) -> BitemporalRecord<U>
pub fn map<U>(self, f: impl FnOnce(T) -> U) -> BitemporalRecord<U>
Map the value of this record through a function, preserving temporal fields.
Sourcepub fn valid_time(&self) -> DateTime<Utc>
pub fn valid_time(&self) -> DateTime<Utc>
Returns the valid time (when the value is true in the domain).
Sourcepub fn recorded_time(&self) -> DateTime<Utc>
pub fn recorded_time(&self) -> DateTime<Utc>
Returns the recorded time (when the system captured this).
Trait Implementations§
Source§impl<T: Clone> Clone for BitemporalRecord<T>
impl<T: Clone> Clone for BitemporalRecord<T>
Source§fn clone(&self) -> BitemporalRecord<T>
fn clone(&self) -> BitemporalRecord<T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T: Debug> Debug for BitemporalRecord<T>
impl<T: Debug> Debug for BitemporalRecord<T>
Source§impl<'de, T> Deserialize<'de> for BitemporalRecord<T>where
T: Deserialize<'de> + Default,
impl<'de, T> Deserialize<'de> for BitemporalRecord<T>where
T: Deserialize<'de> + Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<T: PartialEq> PartialEq for BitemporalRecord<T>
impl<T: PartialEq> PartialEq for BitemporalRecord<T>
Source§fn eq(&self, other: &BitemporalRecord<T>) -> bool
fn eq(&self, other: &BitemporalRecord<T>) -> bool
self and other values to be equal, and is used by ==.