Function count_alerts

Source
pub async fn count_alerts(
    pool: &Pool<MySql>,
    status: Option<&str>,
    severity: Option<&str>,
    org_id: Option<i64>,
    app_id: Option<i64>,
) -> Result<i64>
Expand description

Counts the total number of alerts in the database with optional filtering.

This function retrieves the total count of alerts that match the provided filter criteria, which is useful for pagination and reporting purposes.

§Arguments

  • pool - Database connection pool for executing the query
  • status - Optional filter for alert status
  • severity - Optional filter for alert severity
  • org_id - Optional filter for organization ID
  • app_id - Optional filter for application ID

§Returns

  • Ok(i64) - Successfully retrieved count of alerts
  • Err(anyhow::Error) - Failed to count alerts