schemas_v1_db_queries_worker - OmniCloudOrg/OmniOrchestrator GitHub Wiki
Path: src/schemas/v1/db/queries/worker.rs
pub async fn list_workers(
pool: &sqlx::Pool<sqlx::MySql>,
page: Option<u64>,
per_page: Option<u64>
) -> Result<Vec<Worker>, sqlx::Error> {
// ... function body
}
pub async fn get_worker_by_id(
pool: &sqlx::Pool<sqlx::MySql>,
worker_id: i64,
) -> Result<Worker, sqlx::Error> {
// ... function body
}
Retrieves a worker by its ID from the database. This function fetches a worker from the database using its unique ID.
-
pool
- Database connection pool for executing the query -
worker_id
- Unique identifier of the worker to fetch
-
Ok(Worker)
- Successfully retrieved worker -
Err(anyhow::Error)
- Failed to fetch worker
-
sqlx::Error
- If the query fails or the worker is not found