Fetch and decode a protobuf message by id.
(
&self,
id: &str,
)
| 369 | |
| 370 | /// Fetch and decode a protobuf message by id. |
| 371 | pub async fn get_message<T: Message + Default + ObjectType + SetResourceVersion>( |
| 372 | &self, |
| 373 | id: &str, |
| 374 | ) -> PersistenceResult<Option<T>> { |
| 375 | self.get(T::object_type(), id) |
| 376 | .await? |
| 377 | .map(decode_record) |
| 378 | .transpose() |
| 379 | } |
| 380 | |
| 381 | /// Fetch and decode a protobuf message by name. |
| 382 | pub async fn get_message_by_name<T: Message + Default + ObjectType + SetResourceVersion>( |