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 querysearch_query
- Text to search for in alert fieldsorg_id
- Optional organization ID to filter alertspage
- Zero-based page number for paginationper_page
- Number of records per page
§Returns
Ok(Vec<Alert>)
- List of matching alertsErr(anyhow::Error)
- Failed to search for alerts