fields are now deleted when the val is empty .... among other changes

This commit is contained in:
Sebastian Moser
2023-01-14 23:14:37 +01:00
parent 5d4ea7256e
commit 188a7b2a7e
8 changed files with 237 additions and 59 deletions

View File

@@ -120,14 +120,14 @@ impl Itemstore {
}
//remove field if new_val is empty
//if (new_val.len() == 0) {
//if let Some(key_index) = keys.iter().position(|x| *x == key.clone()){
//keys.remove(key_index);
//}
//tr.del(key).await?;
//} else {
//tr.set(store_key.clone(), new_val).await?;
//}
if (new_val.len() == 0) {
if let Some(key_index) = old_keys.iter().position(|x| *x == key.clone()){
old_keys.remove(key_index);
}
tr.del(key).await?;
} else {
tr.set(store_key.clone(), new_val).await?;
}
}
//write keys again