(
&self,
object_type: &str,
scope: &str,
limit: u32,
offset: u32,
)
| 369 | } |
| 370 | |
| 371 | pub async fn list_by_scope( |
| 372 | &self, |
| 373 | object_type: &str, |
| 374 | scope: &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 |
| 381 | FROM objects |
| 382 | WHERE object_type = $1 AND scope = $2 |
| 383 | ORDER BY created_at_ms ASC, name ASC |
| 384 | LIMIT $3 OFFSET $4 |
| 385 | ", |
| 386 | ) |
| 387 | .bind(object_type) |
| 388 | .bind(scope) |
| 389 | .bind(i64::from(limit)) |
| 390 | .bind(i64::from(offset)) |
| 391 | .fetch_all(&self.pool) |
| 392 | .await |
| 393 | .map_err(|e| map_db_error(&e))?; |
| 394 | |
| 395 | Ok(rows.into_iter().map(row_to_object_record).collect()) |
| 396 | } |
| 397 | |
| 398 | pub async fn list_with_selector( |
| 399 | &self, |
nothing calls this directly
no test coverage detected