Expand description
§pleme-database
Database utilities library for Pleme platform services.
§Features
- Connection Pooling - Managed PostgreSQL connection pools
- Transactions - Transactional operations with rollback
- Repository Pattern - Clean data access layer abstraction
- Cache Integration - Redis caching with automatic invalidation
§Usage
use pleme_database::{DatabasePool, Repository};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let pool = DatabasePool::connect("postgres://localhost/mydb").await?;
// Use repository pattern
let users = UserRepository::new(pool);
let user = users.find_by_id("123").await?;
Ok(())
}Re-exports§
pub use pool::DatabasePool;pub use pool::PoolConfig;pub use transaction::Transaction;pub use transaction::Transactional;pub use repository::Repository;pub use repository::SoftDelete;pub use repository::ProductScoped;pub use repository::PaginatedRepository;pub use repository::PaginationParams;pub use repository::PaginatedResponse;pub use repository::BaseRepository;
Modules§
- pool
- Database connection pool management
- repository
- Repository pattern for data access
- transaction
- Transaction management
Enums§
- Database
Error - Database errors
Type Aliases§
- Result
- Result type for database operations