join adds a join table to the selector with the given kind.
(kind string, t TableView)
| 2109 | |
| 2110 | // join adds a join table to the selector with the given kind. |
| 2111 | func (s *Selector) join(kind string, t TableView) *Selector { |
| 2112 | s.joins = append(s.joins, join{ |
| 2113 | kind: kind, |
| 2114 | table: t, |
| 2115 | }) |
| 2116 | switch view := t.(type) { |
| 2117 | case *SelectTable: |
| 2118 | if view.as == "" { |
| 2119 | view.as = "t" + strconv.Itoa(len(s.joins)) |
| 2120 | } |
| 2121 | case *Selector: |
| 2122 | if view.as == "" { |
| 2123 | view.as = "t" + strconv.Itoa(len(s.joins)) |
| 2124 | } |
| 2125 | } |
| 2126 | if st, ok := t.(state); ok { |
| 2127 | st.SetDialect(s.dialect) |
| 2128 | } |
| 2129 | return s |
| 2130 | } |
| 2131 | |
| 2132 | type ( |
| 2133 | // setOp represents a set/compound operation. |
no test coverage detected