1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//! # Ferrox Database Core (`ferrox-database-core`)
//!
//! `ferrox-database-core` defines the abstract persistence layer for Ferrox applications, introducing the generic `Repository<T, Id>` trait.
//!
//! ## Inversion of Control & Persistence Decoupling
//! By depending on `Repository<T, Id>` traits rather than concrete database drivers (SQL, Mongo, Redis), domain logic and services stay
//! completely decoupled from database engine details. This enables seamless unit testing via in-memory mock repositories.
//!
//! ## Key Features
//! - 📥 **Generic `Repository<Entity, Id>` Trait**: Standard `find_by_id`, `find_all`, `save`, `update`, and `delete` methods.
//! - 🧪 **Testing Mocks**: Simplify unit tests without launching database containers.
use async_trait;
use AppError;
/// Core Repository Trait
/// This is the equivalent of the base repository in TypeORM/NestJS.
/// Implementations (like SeaORM or Mongo) will implement this trait for specific entities.