Function search_alerts

Source
pub async fn search_alerts(
    pool: &Pool<MySql>,
    search_query: &str,
    org_id: Option<i64>,
    page: i64,
    per_page: i64,
) -> Result<Vec<Alert>>
Expand description

Retrieves alerts that match a specific search query.

This function searches for alerts containing specific text in their message, type, or service fields. It’s useful for implementing search functionality in the alerts UI.

§Arguments

  • pool - Database connection pool for executing the query
  • search_query - Text to search for in alert fields
  • org_id - Optional organization ID to filter alerts
  • page - Zero-based page number for pagination
  • per_page - Number of records per page

§Returns

  • Ok(Vec<Alert>) - List of matching alerts
  • Err(anyhow::Error) - Failed to search for alerts