Repository

Trait Repository 

Source
pub trait Repository {
    type Entity: Debug + Clone;
    type UIDType: UID;

    // Required methods
    fn find_by_uid(&self, uid: Self::UIDType) -> Result<Self::Entity, BaseError>;
    fn create(&mut self, entity: Self::Entity) -> Result<(), BaseError>;
    fn update_by_uid(
        &mut self,
        uid: Self::UIDType,
        entity: Self::Entity,
    ) -> Result<(), BaseError>;
    fn remove_by_uid(&mut self, uid: Self::UIDType) -> Result<(), BaseError>;
}
Expand description

Repository is an trait abstraction used for Repository Pattern

Required Associated Types§

Required Methods§

Source

fn find_by_uid(&self, uid: Self::UIDType) -> Result<Self::Entity, BaseError>

Source

fn create(&mut self, entity: Self::Entity) -> Result<(), BaseError>

Source

fn update_by_uid( &mut self, uid: Self::UIDType, entity: Self::Entity, ) -> Result<(), BaseError>

Source

fn remove_by_uid(&mut self, uid: Self::UIDType) -> Result<(), BaseError>

Implementors§