(
&'a self,
v: &'a CreateSubsourceStatement<T>,
)
| 393 | } |
| 394 | |
| 395 | pub(crate) fn doc_create_subsource<'a, T: AstInfo>( |
| 396 | &'a self, |
| 397 | v: &'a CreateSubsourceStatement<T>, |
| 398 | ) -> RcDoc<'a> { |
| 399 | let mut docs = Vec::new(); |
| 400 | |
| 401 | // CREATE SUBSOURCE [IF NOT EXISTS] name |
| 402 | let mut title = "CREATE SUBSOURCE".to_string(); |
| 403 | if v.if_not_exists { |
| 404 | title.push_str(" IF NOT EXISTS"); |
| 405 | } |
| 406 | |
| 407 | // Table name with columns/constraints |
| 408 | let mut col_items = Vec::new(); |
| 409 | col_items.extend(v.columns.iter().map(|c| self.doc_display_pass(c))); |
| 410 | col_items.extend(v.constraints.iter().map(|c| self.doc_display_pass(c))); |
| 411 | |
| 412 | let table_def = nest( |
| 413 | self.doc_display_pass(&v.name), |
| 414 | bracket("(", comma_separated(col_items), ")"), |
| 415 | ); |
| 416 | docs.push(nest_title(title, table_def)); |
| 417 | |
| 418 | // OF SOURCE |
| 419 | if let Some(of_source) = &v.of_source { |
| 420 | docs.push(nest_title("OF SOURCE", self.doc_display_pass(of_source))); |
| 421 | } |
| 422 | |
| 423 | // WITH options |
| 424 | if !v.with_options.is_empty() { |
| 425 | docs.push(bracket( |
| 426 | "WITH (", |
| 427 | comma_separate(|wo| self.doc_display_pass(wo), &v.with_options), |
| 428 | ")", |
| 429 | )); |
| 430 | } |
| 431 | |
| 432 | RcDoc::intersperse(docs, Doc::line()).group() |
| 433 | } |
| 434 | |
| 435 | pub(crate) fn doc_create_cluster<'a, T: AstInfo>( |
| 436 | &'a self, |
no test coverage detected