func TestOn(t *testing.T) { on := nodes.On(1) expected := "ON 1" if got, _ := sql.Accept(on); expected != got { t.Errorf("TestOn was expected to return %s, got %s", expected, got) } }
// Sets the last stored Join's Right leaf to a OnNode containing the // given expression. func (self *SelectManager) On(expr interface{}) *SelectManager { joins := self.Context.Source.Right if 0 == len(joins) { return self } last := joins[len(joins)-1] switch last.(type) { case *nodes.InnerJoinNode: last.(*nodes.InnerJoinNode).Right = nodes.On(expr) case *nodes.OuterJoinNode: last.(*nodes.OuterJoinNode).Right = nodes.On(expr) } return self }