sql_fun_sqlast/sem/names/
local.rs1use std::{fmt::Display, ops::Deref};
2
3#[derive(Debug, Clone, Eq, PartialEq, Hash, serde::Serialize, serde::Deserialize)]
5#[serde(transparent)]
6pub struct LocalName(String);
7
8impl LocalName {
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 #[must_use]
22 pub fn is_record(&self) -> bool {
23 &self.0 == "record"
24 }
25}
26
27impl Display for LocalName {
28 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
29 write!(f, "{}", self.0)
30 }
31}
32
33impl Deref for LocalName {
34 type Target = str;
35
36 fn deref(&self) -> &Self::Target {
37 self.0.as_ref()
38 }
39}