| 712 | } |
| 713 | } |
| 714 | fn suffix<'a, T: AstInfo>(constraint: &'a JoinConstraint<T>) -> impl AstDisplay + 'a { |
| 715 | struct Suffix<'a, T: AstInfo>(&'a JoinConstraint<T>); |
| 716 | impl<'a, T: AstInfo> AstDisplay for Suffix<'a, T> { |
| 717 | fn fmt<W>(&self, f: &mut AstFormatter<W>) |
| 718 | where |
| 719 | W: fmt::Write, |
| 720 | { |
| 721 | match self.0 { |
| 722 | JoinConstraint::On(expr) => { |
| 723 | f.write_str(" ON "); |
| 724 | f.write_node(expr); |
| 725 | } |
| 726 | JoinConstraint::Using { columns, alias } => { |
| 727 | f.write_str(" USING ("); |
| 728 | f.write_node(&display::comma_separated(columns)); |
| 729 | f.write_str(")"); |
| 730 | |
| 731 | if let Some(join_using_alias) = alias { |
| 732 | f.write_str(" AS "); |
| 733 | f.write_node(join_using_alias); |
| 734 | } |
| 735 | } |
| 736 | JoinConstraint::Natural => {} |
| 737 | } |
| 738 | } |
| 739 | } |
| 740 | Suffix(constraint) |
| 741 | } |
| 742 | match &self.join_operator { |
| 743 | JoinOperator::Inner(constraint) => { |
| 744 | f.write_str(" "); |