Esempio n. 1
0
// Appends a new InnerJoin to the current Context's SourceNode.
func (self *SelectManager) OuterJoin(table interface{}) *SelectManager {
	switch table.(type) {
	case Accessor:
		self.Context.Source.Right = append(self.Context.Source.Right, nodes.OuterJoin(table.(Accessor).Relation(), nil))
	case *nodes.RelationNode:
		self.Context.Source.Right = append(self.Context.Source.Right, nodes.OuterJoin(table.(*nodes.RelationNode), nil))
	}

	return self
}
Esempio n. 2
0
func TestOuterJoin(t *testing.T) {
	join := nodes.OuterJoin(1, 2)
	expected := "LEFT OUTER JOIN 1 2"
	if got, _ := sql.Accept(join); expected != got {
		t.Errorf("TestOuterJoin was expected to return %s, got %s", expected, got)
	}
}