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