MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / doc_table_factor

Method doc_table_factor

src/sql-pretty/src/doc.rs:1106–1136  ·  view source on GitHub ↗
(&'a self, v: &'a TableFactor<T>)

Source from the content-addressed store, hash-verified

1104 }
1105
1106 fn doc_table_factor<'a, T: AstInfo>(&'a self, v: &'a TableFactor<T>) -> RcDoc<'a> {
1107 match v {
1108 TableFactor::Derived {
1109 lateral,
1110 subquery,
1111 alias,
1112 } => {
1113 let prefix = if *lateral { "LATERAL (" } else { "(" };
1114 let mut docs = vec![bracket(prefix, self.doc_query(subquery), ")")];
1115 if let Some(alias) = alias {
1116 docs.push(RcDoc::text(format!("AS {}", alias)));
1117 }
1118 intersperse_line_nest(docs)
1119 }
1120 TableFactor::NestedJoin { join, alias } => {
1121 let mut doc = bracket("(", self.doc_table_with_joins(join), ")");
1122 if let Some(alias) = alias {
1123 doc = nest(doc, RcDoc::text(format!("AS {}", alias)));
1124 }
1125 doc
1126 }
1127 TableFactor::Table { name, alias } => {
1128 let mut doc = self.doc_display_pass(name);
1129 if let Some(alias) = alias {
1130 doc = nest(doc, RcDoc::text(format!("AS {}", alias)));
1131 }
1132 doc
1133 }
1134 _ => self.doc_display(v, "table factor variant"),
1135 }
1136 }
1137
1138 fn doc_distinct<'a, T: AstInfo>(&'a self, v: &'a Distinct<T>) -> RcDoc<'a> {
1139 match v {

Callers 1

doc_joinMethod · 0.80

Calls 7

intersperse_line_nestFunction · 0.85
bracketFunction · 0.85
nestFunction · 0.85
doc_table_with_joinsMethod · 0.80
doc_display_passMethod · 0.80
doc_displayMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected