(
&'a self,
v: &'a CreateWebhookSourceStatement<T>,
)
| 95 | } |
| 96 | |
| 97 | pub(crate) fn doc_create_webhook_source<'a, T: AstInfo>( |
| 98 | &'a self, |
| 99 | v: &'a CreateWebhookSourceStatement<T>, |
| 100 | ) -> RcDoc<'a> { |
| 101 | let mut docs = Vec::new(); |
| 102 | |
| 103 | let mut title = "CREATE ".to_string(); |
| 104 | if v.is_table { |
| 105 | title.push_str("TABLE"); |
| 106 | } else { |
| 107 | title.push_str("SOURCE"); |
| 108 | } |
| 109 | if v.if_not_exists { |
| 110 | title.push_str(" IF NOT EXISTS"); |
| 111 | } |
| 112 | docs.push(nest_title(title, self.doc_display_pass(&v.name))); |
| 113 | |
| 114 | // IN CLUSTER (only for sources, not tables) |
| 115 | if !v.is_table { |
| 116 | if let Some(cluster) = &v.in_cluster { |
| 117 | docs.push(nest_title("IN CLUSTER", self.doc_display_pass(cluster))); |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | docs.push(RcDoc::text("FROM WEBHOOK")); |
| 122 | docs.push(nest_title( |
| 123 | "BODY FORMAT", |
| 124 | self.doc_display_pass(&v.body_format), |
| 125 | )); |
| 126 | |
| 127 | if !v.include_headers.mappings.is_empty() || v.include_headers.column.is_some() { |
| 128 | let mut header_docs = Vec::new(); |
| 129 | |
| 130 | // Individual header mappings |
| 131 | for mapping in &v.include_headers.mappings { |
| 132 | header_docs.push(self.doc_display_pass(mapping)); |
| 133 | } |
| 134 | |
| 135 | // INCLUDE HEADERS column |
| 136 | if let Some(filters) = &v.include_headers.column { |
| 137 | if filters.is_empty() { |
| 138 | header_docs.push(RcDoc::text("INCLUDE HEADERS")); |
| 139 | } else { |
| 140 | header_docs.push(bracket( |
| 141 | "INCLUDE HEADERS (", |
| 142 | comma_separate(|f| self.doc_display_pass(f), filters), |
| 143 | ")", |
| 144 | )); |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | if !header_docs.is_empty() { |
| 149 | docs.extend(header_docs); |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | if let Some(check) = &v.validate_using { |
| 154 | docs.push(self.doc_webhook_check(check)); |
no test coverage detected