Skip to main content

Module repository

Module repository 

Source
Expand description

Repository port traits for data access.

These traits define the interface between the domain layer and the persistence layer. Implementations live in adapter crates (e.g. aro-fletch), keeping the core free of framework dependencies.

All trait methods return BoxFuture so that the traits are object-safe and can be used with dyn Repository<T> for dynamic dispatch (e.g. via Dep<dyn Repository<User>>).

§Example

async fn get_user(
    repo: &dyn Repository<User>,
    id: u64,
) -> Result<User, RepoError> {
    repo.find_by_id(id).await
}

Traits§

Paginatable
Trait for repositories that support paginated queries over all rows.
Queryable
Trait for repositories that support filtered and sorted queries.
Repository
Core CRUD repository trait for a given entity type.
TransactionManager
Trait for managing transactional boundaries across repository operations.

Type Aliases§

BoxFuture
A boxed future that is Send and tied to the lifetime of &self.