Skip to main content

ModuleRepository

Trait ModuleRepository 

Source
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§

Source

fn exists(&self, id: &str) -> bool

Check if a module exists.

Source

fn get(&self, id_or_name: &str) -> Result<Module, DomainError>

Get a module by ID or full name.

Source

fn list(&self) -> Result<Vec<ModuleSummary>, DomainError>

List all modules.

Provided Methods§

Source

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.

Source

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.

Implementors§