Skip to main content

as_of_query

Function as_of_query 

Source
pub fn as_of_query<T>(
    records: &[BitemporalRecord<T>],
    valid_time: DateTime<Utc>,
    recorded_time: DateTime<Utc>,
) -> Vec<BitemporalRecord<T>>
where T: Clone,
Expand description

Query records valid at a specific valid_time as of a specific recorded_time.

This implements the bitemporal “as-of” query:

  • Returns records whose valid_time is at or before the query valid_time
  • Among those, returns the version that was current as of recorded_time (i.e., the latest record with recorded_time <= query_recorded_time)

§Arguments

  • records — slice of all records (simulating a database table)
  • valid_time — the business time to query
  • recorded_time — the system time to query as-of

§Returns

Records valid at valid_time as of recorded_time.