(&'a self, v: &'a Select<T>)
| 1147 | } |
| 1148 | |
| 1149 | fn doc_select<'a, T: AstInfo>(&'a self, v: &'a Select<T>) -> RcDoc<'a> { |
| 1150 | let mut docs = vec![]; |
| 1151 | let mut select = RcDoc::text("SELECT"); |
| 1152 | if let Some(distinct) = &v.distinct { |
| 1153 | select = nest(select, self.doc_distinct(distinct)); |
| 1154 | } |
| 1155 | docs.push(nest_comma_separate( |
| 1156 | select, |
| 1157 | |s| self.doc_select_item(s), |
| 1158 | &v.projection, |
| 1159 | )); |
| 1160 | if !v.from.is_empty() { |
| 1161 | docs.push(title_comma_separate( |
| 1162 | "FROM", |
| 1163 | |t| self.doc_table_with_joins(t), |
| 1164 | &v.from, |
| 1165 | )); |
| 1166 | } |
| 1167 | if let Some(selection) = &v.selection { |
| 1168 | docs.push(nest_title("WHERE", self.doc_expr(selection))); |
| 1169 | } |
| 1170 | if !v.group_by.is_empty() { |
| 1171 | docs.push(title_comma_separate( |
| 1172 | "GROUP BY", |
| 1173 | |e| self.doc_expr(e), |
| 1174 | &v.group_by, |
| 1175 | )); |
| 1176 | } |
| 1177 | if let Some(having) = &v.having { |
| 1178 | docs.push(nest_title("HAVING", self.doc_expr(having))); |
| 1179 | } |
| 1180 | if let Some(qualify) = &v.qualify { |
| 1181 | docs.push(nest_title("QUALIFY", self.doc_expr(qualify))); |
| 1182 | } |
| 1183 | if !v.options.is_empty() { |
| 1184 | docs.push(bracket( |
| 1185 | "OPTIONS (", |
| 1186 | comma_separate(|o| self.doc_display_pass(o), &v.options), |
| 1187 | ")", |
| 1188 | )); |
| 1189 | } |
| 1190 | RcDoc::intersperse(docs, Doc::line()).group() |
| 1191 | } |
| 1192 | |
| 1193 | fn doc_select_item<'a, T: AstInfo>(&'a self, v: &'a SelectItem<T>) -> RcDoc<'a> { |
| 1194 | match v { |
no test coverage detected