MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / fold_cluster_name

Method fold_cluster_name

src/sql/src/names.rs:1940–1978  ·  view source on GitHub ↗
(
        &mut self,
        cluster_name: <Raw as AstInfo>::ClusterName,
    )

Source from the content-addressed store, hash-verified

1938 }
1939
1940 fn fold_cluster_name(
1941 &mut self,
1942 cluster_name: <Raw as AstInfo>::ClusterName,
1943 ) -> <Aug as AstInfo>::ClusterName {
1944 match cluster_name {
1945 RawClusterName::Unresolved(ident) => {
1946 match self.catalog.resolve_cluster(Some(ident.as_str())) {
1947 Ok(cluster) => ResolvedClusterName {
1948 id: cluster.id(),
1949 print_name: None,
1950 },
1951 Err(e) => {
1952 self.status = Err(e.into());
1953 ResolvedClusterName {
1954 // The ID is arbitrary here; we just need some dummy
1955 // value to return.
1956 id: ClusterId::system(0).expect("0 is a valid ID"),
1957 print_name: None,
1958 }
1959 }
1960 }
1961 }
1962 RawClusterName::Resolved(ident) => match ident.parse() {
1963 Ok(id) => ResolvedClusterName {
1964 id,
1965 print_name: None,
1966 },
1967 Err(e) => {
1968 self.status = Err(e.into());
1969 ResolvedClusterName {
1970 // The ID is arbitrary here; we just need some dummy
1971 // value to return.
1972 id: ClusterId::system(0).expect("0 is a valid ID"),
1973 print_name: None,
1974 }
1975 }
1976 },
1977 }
1978 }
1979
1980 fn fold_with_option_value(
1981 &mut self,

Callers 2

fold_object_nameMethod · 0.80
foldMethod · 0.80

Calls 5

expectMethod · 0.80
resolve_clusterMethod · 0.45
as_strMethod · 0.45
idMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected