(
&self,
object_type: &str,
scope: &str,
limit: u32,
offset: u32,
)
| 395 | } |
| 396 | |
| 397 | pub async fn list_by_scope( |
| 398 | &self, |
| 399 | object_type: &str, |
| 400 | scope: &str, |
| 401 | limit: u32, |
| 402 | offset: u32, |
| 403 | ) -> PersistenceResult<Vec<ObjectRecord>> { |
| 404 | let rows = sqlx::query( |
| 405 | r#" |
| 406 | SELECT "object_type", "id", "name", "payload", "created_at_ms", "updated_at_ms", "labels" |
| 407 | FROM "objects" |
| 408 | WHERE "object_type" = ?1 AND "scope" = ?2 |
| 409 | ORDER BY "created_at_ms" ASC, "name" ASC |
| 410 | LIMIT ?3 OFFSET ?4 |
| 411 | "#, |
| 412 | ) |
| 413 | .bind(object_type) |
| 414 | .bind(scope) |
| 415 | .bind(i64::from(limit)) |
| 416 | .bind(i64::from(offset)) |
| 417 | .fetch_all(&self.pool) |
| 418 | .await |
| 419 | .map_err(|e| map_db_error(&e))?; |
| 420 | |
| 421 | Ok(rows.into_iter().map(row_to_object_record).collect()) |
| 422 | } |
| 423 | pub async fn list_with_selector( |
| 424 | &self, |
| 425 | object_type: &str, |
nothing calls this directly
no test coverage detected