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