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