use std::sync::Arc;
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub enum SchemaReference {
Bare { schema: Arc<str> },
Full { schema: Arc<str>, catalog: Arc<str> },
}
impl SchemaReference {
pub fn schema_name(&self) -> &str {
match self {
SchemaReference::Bare { schema } => schema,
SchemaReference::Full { schema, catalog: _ } => schema,
}
}
}
impl std::fmt::Display for SchemaReference {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Bare { schema } => write!(f, "{schema}"),
Self::Full { schema, catalog } => write!(f, "{catalog}.{schema}"),
}
}
}