pub struct DocumentStore { /* private fields */ }Implementations§
Source§impl DocumentStore
impl DocumentStore
pub fn new(base_path: PathBuf) -> Self
Sourcepub fn path_for(&self, name: &str) -> PathBuf
pub fn path_for(&self, name: &str) -> PathBuf
Resolve the on-disk path for a note name (with or without a .md
extension), without reading the file. Used e.g. to move a note when
renaming it.
We deliberately do not rely on Path::extension, which would treat the
trailing part of a dotted note name (e.g. “sprint-q2.6”) as the
extension and skip adding .md.
Sourcepub fn load(&self, name: &str) -> Result<Document, String>
pub fn load(&self, name: &str) -> Result<Document, String>
Load a document by name (with or without .md extension) If the file doesn’t exist, creates an empty document that will be saved on first write
Sourcepub fn list_all_documents(&self) -> Result<Vec<String>, String>
pub fn list_all_documents(&self) -> Result<Vec<String>, String>
Recursively list all markdown files in the directory and subdirectories Returns relative paths from base_path (e.g., “project-a/standup”)
Sourcepub fn save(&self, doc: &Document) -> Result<(), String>
pub fn save(&self, doc: &Document) -> Result<(), String>
Save document content Creates parent directories if they don’t exist
Sourcepub fn delete(&self, name: &str) -> Result<(), String>
pub fn delete(&self, name: &str) -> Result<(), String>
Delete a note’s file from disk.
A note that was never written (e.g. a brand-new, never-typed-into note) has no file yet; a missing file is treated as success so that deleting always leaves the note gone. Only a real I/O failure returns an error.