(
&'a self,
v: &'a CreateSinkStatement<T>,
)
| 345 | } |
| 346 | |
| 347 | pub(crate) fn doc_create_sink<'a, T: AstInfo>( |
| 348 | &'a self, |
| 349 | v: &'a CreateSinkStatement<T>, |
| 350 | ) -> RcDoc<'a> { |
| 351 | let mut docs = Vec::new(); |
| 352 | |
| 353 | // CREATE SINK [IF NOT EXISTS] [name] |
| 354 | let mut title = "CREATE SINK".to_string(); |
| 355 | if v.if_not_exists { |
| 356 | title.push_str(" IF NOT EXISTS"); |
| 357 | } |
| 358 | |
| 359 | if let Some(name) = &v.name { |
| 360 | docs.push(nest_title(title, self.doc_display_pass(name))); |
| 361 | } else { |
| 362 | docs.push(RcDoc::text(title)); |
| 363 | } |
| 364 | |
| 365 | if let Some(cluster) = &v.in_cluster { |
| 366 | docs.push(nest_title("IN CLUSTER", self.doc_display_pass(cluster))); |
| 367 | } |
| 368 | |
| 369 | docs.push(nest_title("FROM", self.doc_display_pass(&v.from))); |
| 370 | docs.push(nest_title("INTO", self.doc_display_pass(&v.connection))); |
| 371 | |
| 372 | if let Some(format) = &v.format { |
| 373 | docs.push(self.doc_format_specifier(format)); |
| 374 | } |
| 375 | |
| 376 | if let Some(envelope) = &v.envelope { |
| 377 | docs.push(nest_title("ENVELOPE", self.doc_display_pass(envelope))); |
| 378 | } |
| 379 | |
| 380 | if let Some(mode) = &v.mode { |
| 381 | docs.push(nest_title("MODE", self.doc_display_pass(mode))); |
| 382 | } |
| 383 | |
| 384 | if !v.with_options.is_empty() { |
| 385 | docs.push(bracket( |
| 386 | "WITH (", |
| 387 | comma_separate(|wo| self.doc_display_pass(wo), &v.with_options), |
| 388 | ")", |
| 389 | )); |
| 390 | } |
| 391 | |
| 392 | RcDoc::intersperse(docs, Doc::line()).group() |
| 393 | } |
| 394 | |
| 395 | pub(crate) fn doc_create_subsource<'a, T: AstInfo>( |
| 396 | &'a self, |
no test coverage detected