(&'a self, v: &'a InsertStatement<T>)
| 880 | } |
| 881 | |
| 882 | pub(crate) fn doc_insert<'a, T: AstInfo>(&'a self, v: &'a InsertStatement<T>) -> RcDoc<'a> { |
| 883 | let mut first = vec![RcDoc::text(format!( |
| 884 | "INSERT INTO {}", |
| 885 | v.table_name.to_ast_string_simple() |
| 886 | ))]; |
| 887 | if !v.columns.is_empty() { |
| 888 | first.push(bracket( |
| 889 | "(", |
| 890 | comma_separate(|c| self.doc_display_pass(c), &v.columns), |
| 891 | ")", |
| 892 | )); |
| 893 | } |
| 894 | let sources = match &v.source { |
| 895 | InsertSource::Query(query) => self.doc_query(query), |
| 896 | InsertSource::DefaultValues => self.doc_display(&v.source, "insert source"), |
| 897 | }; |
| 898 | let mut doc = intersperse_line_nest([intersperse_line_nest(first), sources]); |
| 899 | if !v.returning.is_empty() { |
| 900 | doc = nest( |
| 901 | doc, |
| 902 | nest_title( |
| 903 | "RETURNING", |
| 904 | comma_separate(|r| self.doc_display_pass(r), &v.returning), |
| 905 | ), |
| 906 | ) |
| 907 | } |
| 908 | doc |
| 909 | } |
| 910 | |
| 911 | pub(crate) fn doc_select_statement<'a, T: AstInfo>( |
| 912 | &'a self, |
no test coverage detected