Delete a single memory by ID.
(&self, memory_id: &MemoryId)
| 177 | |
| 178 | /// Delete a single memory by ID. |
| 179 | pub async fn delete_memory(&self, memory_id: &MemoryId) -> GraphBitResult<()> { |
| 180 | let id = memory_id.to_string(); |
| 181 | let conn_arc = Arc::clone(&self.conn); |
| 182 | |
| 183 | tokio::task::spawn_blocking(move || -> GraphBitResult<()> { |
| 184 | let conn = conn_arc.blocking_lock(); |
| 185 | conn.execute("DELETE FROM memories WHERE id = ?1", rusqlite::params![id])?; |
| 186 | Ok(()) |
| 187 | }) |
| 188 | .await |
| 189 | .map_err(|e| GraphBitError::memory(format!("Join error: {e}")))? |
| 190 | } |
| 191 | |
| 192 | /// Delete all memories matching the given scope. |
| 193 | pub async fn delete_all_memories(&self, scope: &MemoryScope) -> GraphBitResult<()> { |