1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use crate::common::{ColumnDefinition, FQName};
use itertools::Itertools;
use std::fmt::{Display, Formatter};
#[derive(PartialEq, Debug, Clone)]
pub struct CreateType {
pub not_exists: bool,
pub name: FQName,
pub columns: Vec<ColumnDefinition>,
}
impl Display for CreateType {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(
f,
"CREATE TYPE {}{} ({})",
if self.not_exists {
"IF NOT EXISTS "
} else {
""
},
self.name,
self.columns.iter().map(|x| x.to_string()).join(", "),
)
}
}