risingwave_sqlparser/ast/
analyze.rs

1use core::fmt::Display;
2
3#[cfg(feature = "serde")]
4use serde::{Deserialize, Serialize};
5
6use crate::ast::ObjectName;
7
8#[derive(Debug, PartialEq, Eq, Clone, Hash)]
9#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
10pub enum AnalyzeTarget {
11    Id(u32),
12    Table(ObjectName),
13    MaterializedView(ObjectName),
14    Index(ObjectName),
15    Sink(ObjectName),
16}
17
18impl Display for AnalyzeTarget {
19    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
20        match self {
21            AnalyzeTarget::Id(id) => write!(f, "ID {}", id),
22            AnalyzeTarget::Table(name) => write!(f, "TABLE {}", name),
23            AnalyzeTarget::MaterializedView(name) => write!(f, "MATERIALIZED VIEW {}", name),
24            AnalyzeTarget::Index(name) => write!(f, "INDEX {}", name),
25            AnalyzeTarget::Sink(name) => write!(f, "SINK {}", name),
26        }
27    }
28}