fixup: reduce some LOC if the only change is `if_xx_exists`
@@ -191,50 +191,33 @@ impl<'de> Deserialize<'de> for Cmd {
table_name,
table_meta,
} => {
- if let Some(x) = if_not_exists {
- // latest
- Cmd::CreateTable(CreateTableReq {
- if_not_exists: x,
- tenant,
- db_name,
- table_name,
- table_meta,
- })
- } else {
- // 20220413
+ // since 20220413 there is an `if_exists` field.
+ let if_not_exists = if_not_exists.unwrap_or_default();
+
Cmd::CreateTable(CreateTableReq {
- if_not_exists: false,
+ if_not_exists,
tenant,
db_name,
table_name,
table_meta,
})
}
- }
cmd_00000000_20220413::Cmd::DropTable {
if_exists,
tenant,
db_name,
table_name,
} => {
- if let Some(x) = if_exists {
- // latest
- Cmd::DropTable(DropTableReq {
- if_exists: x,
- tenant,
- db_name,
- table_name,
- })
- } else {
- // 20220413
+ // since 20220413 there is an `if_exists` field.
+ let if_exists = if_exists.unwrap_or_default();
+
Cmd::DropTable(DropTableReq {
- if_exists: false,
+ if_exists,
tenant,
db_name,
table_name,
})
}
- }
cmd_00000000_20220413::Cmd::RenameTable {
if_exists,
tenant,
@@ -243,20 +226,11 @@ impl<'de> Deserialize<'de> for Cmd {
new_db_name,
new_table_name,
} => {
- if let Some(x) = if_exists {
- // latest
- Cmd::RenameTable(RenameTableReq {
- if_exists: x,
- tenant,
- db_name,
- table_name,
- new_db_name,
- new_table_name,
- })
- } else {
- // 20220413
+ // since 20220413 there is an `if_exists` field.
+ let if_exists = if_exists.unwrap_or_default();
+
Cmd::RenameTable(RenameTableReq {
- if_exists: false,
+ if_exists,
tenant,
db_name,
table_name,
@@ -264,7 +238,6 @@ impl<'de> Deserialize<'de> for Cmd {
new_table_name,
})
}
- }
cmd_00000000_20220413::Cmd::CreateShare(x) => Cmd::CreateShare(x),
cmd_00000000_20220413::Cmd::DropShare(x) => Cmd::DropShare(x),
cmd_00000000_20220413::Cmd::UpsertTableOptions(x) => Cmd::UpsertTableOptions(x),
