(
&self,
object_type: &str,
limit: u32,
offset: u32,
)
| 370 | } |
| 371 | |
| 372 | pub async fn list( |
| 373 | &self, |
| 374 | object_type: &str, |
| 375 | limit: u32, |
| 376 | offset: u32, |
| 377 | ) -> PersistenceResult<Vec<ObjectRecord>> { |
| 378 | let rows = sqlx::query( |
| 379 | r#" |
| 380 | SELECT "object_type", "id", "name", "payload", "created_at_ms", "updated_at_ms", "labels", "resource_version" |
| 381 | FROM "objects" |
| 382 | WHERE "object_type" = ?1 |
| 383 | ORDER BY "created_at_ms" ASC, "name" ASC |
| 384 | LIMIT ?2 OFFSET ?3 |
| 385 | "#, |
| 386 | ) |
| 387 | .bind(object_type) |
| 388 | .bind(i64::from(limit)) |
| 389 | .bind(i64::from(offset)) |
| 390 | .fetch_all(&self.pool) |
| 391 | .await |
| 392 | .map_err(|e| map_db_error(&e))?; |
| 393 | |
| 394 | Ok(rows.into_iter().map(row_to_object_record).collect()) |
| 395 | } |
| 396 | |
| 397 | pub async fn list_by_scope( |
| 398 | &self, |
no test coverage detected