mset / mget commands (cli currently only supports mget)

This commit is contained in:
2025-07-01 18:33:13 +02:00
parent cff5c37a40
commit c527bb0072
14 changed files with 448 additions and 43 deletions

View File

@@ -15,6 +15,10 @@ pub struct Delete {
}
impl Delete {
pub fn new(key: String) -> Self {
Self { key }
}
pub async fn execute(self, db: &Database, connection: &mut Connection) -> Result<()> {
let value = db.delete(&self.key).await;
@@ -31,4 +35,13 @@ impl Delete {
Ok(Self { key })
}
pub fn put(&self, buf: &mut BytesMut) -> Result<()> {
buf.put_short_string("delete")?;
self.put_without_cmd_name(buf)
}
pub fn put_without_cmd_name(&self, buf: &mut BytesMut) -> Result<()> {
buf.put_short_string(&self.key)
}
}