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