(
&self,
object_type: &str,
name: &str,
)
| 303 | } |
| 304 | |
| 305 | pub async fn get_by_name( |
| 306 | &self, |
| 307 | object_type: &str, |
| 308 | name: &str, |
| 309 | ) -> PersistenceResult<Option<ObjectRecord>> { |
| 310 | let row = sqlx::query( |
| 311 | r" |
| 312 | SELECT object_type, id, name, payload, created_at_ms, updated_at_ms, labels, resource_version |
| 313 | FROM objects |
| 314 | WHERE object_type = $1 AND name = $2 |
| 315 | ", |
| 316 | ) |
| 317 | .bind(object_type) |
| 318 | .bind(name) |
| 319 | .fetch_optional(&self.pool) |
| 320 | .await |
| 321 | .map_err(|e| map_db_error(&e))?; |
| 322 | |
| 323 | Ok(row.map(row_to_object_record)) |
| 324 | } |
| 325 | |
| 326 | pub async fn delete(&self, object_type: &str, id: &str) -> PersistenceResult<bool> { |
| 327 | let result = sqlx::query("DELETE FROM objects WHERE object_type = $1 AND id = $2") |
nothing calls this directly
no test coverage detected