pub struct ProjectManager { /* private fields */ }Expand description
Manages Projects: CRUD, lookup, and detection.
Projects are persisted in the projects SQLite table
(same memory.db as memories).
Implementations§
Source§impl ProjectManager
impl ProjectManager
Sourcepub fn new(db: Arc<MemoryDatabase>, event_bus: Option<EventBus>) -> Result<Self>
pub fn new(db: Arc<MemoryDatabase>, event_bus: Option<EventBus>) -> Result<Self>
Create a new ProjectManager, loading existing projects from SQLite.
Sourcepub fn list_projects(&self) -> Vec<Project>
pub fn list_projects(&self) -> Vec<Project>
List all projects.
Sourcepub fn get_project(&self, id: ProjectId) -> Option<Project>
pub fn get_project(&self, id: ProjectId) -> Option<Project>
Get a project by ID.
Sourcepub fn get_project_by_name(&self, name: &str) -> Option<Project>
pub fn get_project_by_name(&self, name: &str) -> Option<Project>
Get a project by name.
Sourcepub fn create_project(
&self,
name: String,
paths: Vec<PathBuf>,
tags: Vec<String>,
emoji: Option<String>,
description: Option<String>,
source: ProjectSource,
) -> Result<Project>
pub fn create_project( &self, name: String, paths: Vec<PathBuf>, tags: Vec<String>, emoji: Option<String>, description: Option<String>, source: ProjectSource, ) -> Result<Project>
Create a new project.
Sourcepub fn update_project(
&self,
id: ProjectId,
name: Option<String>,
paths: Option<Vec<PathBuf>>,
tags: Option<Vec<String>>,
emoji: Option<String>,
description: Option<String>,
) -> Result<Project>
pub fn update_project( &self, id: ProjectId, name: Option<String>, paths: Option<Vec<PathBuf>>, tags: Option<Vec<String>>, emoji: Option<String>, description: Option<String>, ) -> Result<Project>
Update an existing project.
Sourcepub fn remove_project(&self, id: ProjectId) -> Result<()>
pub fn remove_project(&self, id: ProjectId) -> Result<()>
Remove a project.
Sourcepub fn detect(&self, message: &str) -> DetectionResult
pub fn detect(&self, message: &str) -> DetectionResult
Try to detect a project from a user message.
Returns the matched ProjectId, or None.
Sourcepub fn link_memory(&self, project_id: ProjectId, memory_id: &str) -> Result<()>
pub fn link_memory(&self, project_id: ProjectId, memory_id: &str) -> Result<()>
Link a memory to a project.
Sourcepub fn unlink_memory(
&self,
project_id: ProjectId,
memory_id: &str,
) -> Result<()>
pub fn unlink_memory( &self, project_id: ProjectId, memory_id: &str, ) -> Result<()>
Unlink a memory from a project.
Sourcepub fn get_project_memory_ids(
&self,
project_id: ProjectId,
) -> Result<Vec<String>>
pub fn get_project_memory_ids( &self, project_id: ProjectId, ) -> Result<Vec<String>>
Get all memory IDs associated with a project.
Sourcepub fn save_project(&self, project: &Project) -> Result<()>
pub fn save_project(&self, project: &Project) -> Result<()>
Save (upsert) a project to SQLite directly.
Used when fields like memory_visible need updating
outside the standard update_project() flow.
Auto Trait Implementations§
impl !Freeze for ProjectManager
impl !RefUnwindSafe for ProjectManager
impl !UnwindSafe for ProjectManager
impl Send for ProjectManager
impl Sync for ProjectManager
impl Unpin for ProjectManager
impl UnsafeUnpin for ProjectManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more