(
&self,
sandbox_id: &str,
version: i64,
)
| 516 | } |
| 517 | |
| 518 | pub async fn get_policy_by_version( |
| 519 | &self, |
| 520 | sandbox_id: &str, |
| 521 | version: i64, |
| 522 | ) -> PersistenceResult<Option<PolicyRecord>> { |
| 523 | let row = sqlx::query( |
| 524 | r" |
| 525 | SELECT id, scope, version, status, payload, created_at_ms |
| 526 | FROM objects |
| 527 | WHERE object_type = $1 AND scope = $2 AND version = $3 |
| 528 | ", |
| 529 | ) |
| 530 | .bind(POLICY_OBJECT_TYPE) |
| 531 | .bind(sandbox_id) |
| 532 | .bind(version) |
| 533 | .fetch_optional(&self.pool) |
| 534 | .await |
| 535 | .map_err(|e| map_db_error(&e))?; |
| 536 | |
| 537 | row.map(row_to_policy_record).transpose() |
| 538 | } |
| 539 | |
| 540 | pub async fn list_policies( |
| 541 | &self, |
no test coverage detected