Expand description
Database operations for CeleRS CLI.
This module provides commands for managing database connections, health checks, and migrations. Currently supports PostgreSQL with planned support for MySQL.
§Features
- Connection testing with latency benchmarks
- Health monitoring and diagnostics
- Connection pool statistics
- Schema migrations (auto-migration via SQLx)
§Examples
use celers_cli::database;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Test database connection
database::db_test_connection(
"postgresql://user:pass@localhost/celers",
false
).await?;
// Check database health
database::db_health("postgresql://user:pass@localhost/celers").await?;
Ok(())
}Functions§
- db_
health - Check database health with comprehensive diagnostics.
- db_
migrate - Run database migrations.
- db_
pool_ stats - Show connection pool statistics.
- db_
test_ connection - Test database connection with optional benchmarking.