sql_fun_sqlast/sem/names/
catalog.rs1use std::fmt::Display;
2
3#[derive(Debug, Clone, Eq, PartialEq, Hash, serde::Serialize, serde::Deserialize)]
5#[serde(transparent)]
6pub struct CatalogName(String);
7
8impl CatalogName {
9 #[must_use]
11 pub fn from(value: &str) -> Self {
12 Self(value.to_string())
13 }
14 #[must_use]
16 pub fn as_str(&self) -> &str {
17 &self.0
18 }
19}
20
21impl PartialEq<str> for CatalogName {
22 fn eq(&self, other: &str) -> bool {
23 self.0 == other
24 }
25}
26
27impl Display for CatalogName {
28 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
29 write!(f, "{}", self.0)
30 }
31}