pub trait ModuleRepository {
// Required methods
fn exists(&self, id: &str) -> bool;
fn get(&self, id_or_name: &str) -> Result<Module, DomainError>;
fn list(&self) -> Result<Vec<ModuleSummary>, DomainError>;
// Provided methods
fn list_sub_modules(
&self,
parent_id: &str,
) -> Result<Vec<SubModuleSummary>, DomainError> { ... }
fn get_sub_module(
&self,
composite_id: &str,
) -> Result<SubModule, DomainError> { ... }
}Expand description
Port for accessing module data.
Domain and adapters should depend on this interface rather than concrete storage details.
Required Methods§
Sourcefn get(&self, id_or_name: &str) -> Result<Module, DomainError>
fn get(&self, id_or_name: &str) -> Result<Module, DomainError>
Get a module by ID or full name.
Sourcefn list(&self) -> Result<Vec<ModuleSummary>, DomainError>
fn list(&self) -> Result<Vec<ModuleSummary>, DomainError>
List all modules.
Provided Methods§
Sourcefn list_sub_modules(
&self,
parent_id: &str,
) -> Result<Vec<SubModuleSummary>, DomainError>
fn list_sub_modules( &self, parent_id: &str, ) -> Result<Vec<SubModuleSummary>, DomainError>
List all sub-modules belonging to a parent module.
parent_id is the parent module identifier (e.g., "024").
The default implementation returns a not-found error so that existing implementors do not need to be updated immediately.
Sourcefn get_sub_module(&self, composite_id: &str) -> Result<SubModule, DomainError>
fn get_sub_module(&self, composite_id: &str) -> Result<SubModule, DomainError>
Get a sub-module by its composite identifier (e.g., "024.01").
The default implementation returns a not-found error so that existing implementors do not need to be updated immediately.