Generate a new [`ErrorMessageObjectDescription`] from an [`ObjectId`].
(
object_id: &ObjectId,
catalog: &dyn SessionCatalog,
)
| 1720 | impl ErrorMessageObjectDescription { |
| 1721 | /// Generate a new [`ErrorMessageObjectDescription`] from an [`ObjectId`]. |
| 1722 | pub fn from_id( |
| 1723 | object_id: &ObjectId, |
| 1724 | catalog: &dyn SessionCatalog, |
| 1725 | ) -> ErrorMessageObjectDescription { |
| 1726 | let object_name = match object_id { |
| 1727 | ObjectId::Cluster(cluster_id) => catalog.get_cluster(*cluster_id).name().to_string(), |
| 1728 | ObjectId::ClusterReplica((cluster_id, replica_id)) => catalog |
| 1729 | .get_cluster_replica(*cluster_id, *replica_id) |
| 1730 | .name() |
| 1731 | .to_string(), |
| 1732 | ObjectId::Database(database_id) => catalog.get_database(database_id).name().to_string(), |
| 1733 | ObjectId::Schema((database_spec, schema_spec)) => { |
| 1734 | let name = catalog.get_schema(database_spec, schema_spec).name(); |
| 1735 | catalog.resolve_full_schema_name(name).to_string() |
| 1736 | } |
| 1737 | ObjectId::Role(role_id) => catalog.get_role(role_id).name().to_string(), |
| 1738 | ObjectId::Item(id) => { |
| 1739 | let name = catalog.get_item(id).name(); |
| 1740 | catalog.resolve_full_name(name).to_string() |
| 1741 | } |
| 1742 | ObjectId::NetworkPolicy(network_policy_id) => catalog |
| 1743 | .get_network_policy(network_policy_id) |
| 1744 | .name() |
| 1745 | .to_string(), |
| 1746 | }; |
| 1747 | ErrorMessageObjectDescription::Object { |
| 1748 | object_type: catalog.get_object_type(object_id), |
| 1749 | object_name: Some(object_name), |
| 1750 | } |
| 1751 | } |
| 1752 | |
| 1753 | /// Generate a new [`ErrorMessageObjectDescription`] from a [`SystemObjectId`]. |
| 1754 | pub fn from_sys_id( |
nothing calls this directly
no test coverage detected