ferrox_database_core/
lib.rs1use async_trait::async_trait;
2use ferrox_errors::AppError;
3
4#[async_trait]
8pub trait Repository<Entity, Id> {
9 async fn find_by_id(&self, id: Id) -> Result<Option<Entity>, AppError>;
11
12 async fn find_all(&self) -> Result<Vec<Entity>, AppError>;
14
15 async fn insert(&self, entity: Entity) -> Result<Entity, AppError>;
17
18 async fn update(&self, id: Id, entity: Entity) -> Result<Entity, AppError>;
20
21 async fn delete(&self, id: Id) -> Result<(), AppError>;
23}
24
25pub fn setup() {
26 println!("ferrox-database-core initialized: Provides Repository traits.");
27}