优化数据序列化:时间戳使用本地时间格式,简化 DataValue 输出
This commit is contained in:
parent
1ddb707a9b
commit
3311823800
|
|
@ -41,9 +41,8 @@ impl PointQuality {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(tag = "kind", content = "value", rename_all = "snake_case")]
|
||||
#[derive(PartialEq)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(untagged)]
|
||||
pub enum DataValue {
|
||||
Null,
|
||||
Bool(bool),
|
||||
|
|
@ -81,12 +80,14 @@ pub struct PointMonitorInfo {
|
|||
pub point_id: Uuid,
|
||||
pub client_handle: u32,
|
||||
pub scan_mode: ScanMode,
|
||||
#[serde(serialize_with = "crate::util::datetime::option_utc_to_local_str")]
|
||||
pub timestamp: Option<DateTime<Utc>>,
|
||||
pub quality: PointQuality,
|
||||
pub value: Option<DataValue>,
|
||||
pub value_type: Option<ValueType>,
|
||||
pub value_text: Option<String>,
|
||||
pub old_value: Option<DataValue>,
|
||||
#[serde(serialize_with = "crate::util::datetime::option_utc_to_local_str")]
|
||||
pub old_timestamp: Option<DateTime<Utc>>,
|
||||
pub value_changed: bool,
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue