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