MCPcopy Index your code
hub / github.com/dropbox/godropbox / TestNestedLeftJoin

Method TestNestedLeftJoin

database/sqlbuilder/table_test.go:175–191  ·  view source on GitHub ↗
(c *gc.C)

Source from the content-addressed store, hash-verified

173}
174
175func (s *TableSuite) TestNestedLeftJoin(c *gc.C) {
176 join1 := table1.InnerJoinOn(table2, Eq(table1Col3, table2Col3))
177 join2 := join1.LeftJoinOn(table3, Eq(table1Col1, table3Col1))
178
179 buf := &bytes.Buffer{}
180
181 err := join2.SerializeSql("db", buf)
182 c.Assert(err, gc.IsNil)
183
184 sql := buf.String()
185 c.Assert(
186 sql,
187 gc.Equals,
188 "`db`.`table1` "+
189 "JOIN `db`.`table2` ON `table1`.`col3`=`table2`.`col3` "+
190 "LEFT JOIN `db`.`table3` ON `table1`.`col1`=`table3`.`col1`")
191}
192
193func (s *TableSuite) TestNestedRightJoin(c *gc.C) {
194 join1 := table1.InnerJoinOn(table2, Eq(table1Col3, table2Col3))

Callers

nothing calls this directly

Calls 5

EqFunction · 0.85
InnerJoinOnMethod · 0.65
LeftJoinOnMethod · 0.65
SerializeSqlMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected