pub async fn get_region_by_id(pool: &Pool<MySql>, id: i64) -> Result<Region>
Expand description
Retrieves a specific region by its unique identifier.
This function fetches detailed information about a single region record. It’s typically used when specific region details are needed, such as for displaying region information or resource allocation.
§Arguments
pool
- Database connection pool for executing the queryid
- Unique identifier of the region to retrieve
§Returns
Ok(Region)
- Successfully retrieved region informationErr(anyhow::Error)
- Failed to fetch region (including if not found)
§Error Handling
Returns an error if no region with the given ID exists or if a database error occurs during the query execution.