basic get / set / delete / has

This commit is contained in:
2025-06-12 15:52:01 +02:00
commit 7a6b1b6954
11 changed files with 916 additions and 0 deletions

25
src/handler.rs Normal file
View File

@@ -0,0 +1,25 @@
use crate::{Result, connection::Connection, database::Database};
#[derive(Debug)]
pub struct Handler {
db: Database,
connection: Connection,
}
impl Handler {
pub fn new(db: Database, connection: Connection) -> Self {
Self { db, connection }
}
pub async fn run(&mut self) -> Result<()> {
while let Ok(command) = self.connection.read_command().await {
let Some(command) = command else {
break;
};
command.execute(&self.db, &mut self.connection).await?;
}
Ok(())
}
}