Function list_apps

Source
pub async fn list_apps(
    pool: &Pool<MySql>,
    page: i64,
    per_page: i64,
) -> Result<Vec<AppWithInstanceCount>>
Expand description

Retrieves a paginated list of applications from the database.

This function fetches a subset of applications based on pagination parameters, ordering them by their ID in ascending order. Pagination helps manage large datasets by retrieving only a specific “page” of results.

§Arguments

  • pool - Database connection pool for executing the query
  • page - Zero-based page number (e.g., 0 for first page, 1 for second page)
  • per_page - Number of records to fetch per page

§Returns

  • Ok(Vec<App>) - Successfully retrieved list of applications
  • Err(anyhow::Error) - Failed to fetch applications, with context

§Examples

let apps = list_apps(&pool, 0, 10).await?; // Get first 10 apps