Skip to content

Commit

Permalink
chore: add serde default to new field
Browse files Browse the repository at this point in the history
  • Loading branch information
shuiyisong committed Sep 15, 2023
1 parent fe5679e commit 8cc8f2b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/common/meta/src/key/datanode_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ impl TableMetaKey for DatanodeTableKey {
pub struct DatanodeTableValue {
pub table_id: TableId,
pub regions: Vec<RegionNumber>,
#[serde(default)]
pub engine: String,
version: u64,
}
Expand Down Expand Up @@ -254,6 +255,11 @@ mod tests {

let actual = DatanodeTableValue::try_from_raw_value(literal).unwrap();
assert_eq!(actual, value);

// test serde default
let raw_str = br#"{"table_id":42,"regions":[1,2,3],"version":1}"#;
let parsed = DatanodeTableValue::try_from_raw_value(raw_str);
assert!(parsed.is_ok());
}

#[test]
Expand Down

0 comments on commit 8cc8f2b

Please sign in to comment.