Expand description
Repository pattern for generic CRUD operations
This module provides a generic repository implementation that encapsulates common database operations for entities.
§Example
use ormkit::repository::Repository;
// Create a repository
let repo = Repository::<User>::new(&pool);
// Find by ID
let user = repo.find_by_id(id).await?;
// Find all
let users = repo.find_all().await?;
// Find with filters
let active_users = repo.find_filtered("status = $1", &["active"]).await?;
// Insert
let mut new_user = UserActiveModel::default();
// ... set fields ...
let user = repo.insert(new_user).await?;
// Update
let user = repo.update(user).await?;
// Delete
repo.delete(id).await?;Structs§
- Repository
- Generic repository for CRUD operations
Enums§
- Repository
Error - Errors that can occur in repository operations
Type Aliases§
- Repository
Result - Result type for repository operations