pulse_core/record.rs
1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3
4/// Core data record with explicit event-time (event-time semantics).
5#[derive(Debug, Clone, Serialize, Deserialize)]
6pub struct Record {
7 pub event_time: DateTime<Utc>,
8 pub value: serde_json::Value,
9}
10
11impl Record {
12 pub fn new(event_time: DateTime<Utc>, value: serde_json::Value) -> Self {
13 Self { event_time, value }
14 }
15 pub fn from_value<V: Into<serde_json::Value>>(v: V) -> Self {
16 Self {
17 event_time: chrono::Utc::now(),
18 value: v.into(),
19 }
20 }
21}