pub trait Repository: Send + Sync {
type Error: Error + Send + Sync;
type Pool;
// Required method
fn pool(&self) -> &Self::Pool;
}Expand description
Base repository trait.
All generated {Entity}Repository traits include these associated types
and methods. This trait is not directly extended but serves as documentation
for the common interface.
§Associated Types
Error— Error type for repository operationsPool— Underlying database pool type
§Example
Generated traits follow this pattern:
ⓘ
#[async_trait]
pub trait UserRepository: Send + Sync {
type Error: std::error::Error + Send + Sync;
type Pool;
fn pool(&self) -> &Self::Pool;
async fn create(&self, dto: CreateUserRequest) -> Result<User, Self::Error>;
async fn find_by_id(&self, id: Uuid) -> Result<Option<User>, Self::Error>;
// ...
}