schemas_v1_db_queries_worker - OmniCloudOrg/OmniOrchestrator GitHub Wiki

worker (src/schemas/v1/db/queries)

Path: src/schemas/v1/db/queries/worker.rs

Table of Contents

Public Items

async fn list_workers

Definition

pub async fn list_workers(
    pool: &sqlx::Pool<sqlx::MySql>,
    page: Option<u64>,
    per_page: Option<u64>
) -> Result<Vec<Worker>, sqlx::Error> {
    // ... function body
}

async fn get_worker_by_id

Definition

pub async fn get_worker_by_id(
    pool: &sqlx::Pool<sqlx::MySql>,
    worker_id: i64,
) -> Result<Worker, sqlx::Error> {
    // ... function body
}

Documentation

Retrieves a worker by its ID from the database. This function fetches a worker from the database using its unique ID.

Arguments
  • pool - Database connection pool for executing the query
  • worker_id - Unique identifier of the worker to fetch
Returns
  • Ok(Worker) - Successfully retrieved worker
  • Err(anyhow::Error) - Failed to fetch worker
Errors
  • sqlx::Error - If the query fails or the worker is not found
⚠️ **GitHub.com Fallback** ⚠️