func TestExcept(t *testing.T) { relationOne := nodes.Relation("table_one") relationTwo := nodes.Relation("table_two") relationThree := nodes.Relation("table_three") one := nodes.SelectStatement(relationOne) two := nodes.SelectStatement(relationTwo) three := nodes.SelectStatement(relationThree) one.Combinator = nodes.Except(one, two) two.Combinator = nodes.Except(two, three) expected := `(SELECT FROM "table_one" EXCEPT (SELECT FROM "table_two" EXCEPT SELECT FROM "table_three"))` if got, _ := sql.Accept(one); expected != got { t.Errorf("TestUnion was expected to return %s, got %s", expected, got) } }
// Except sets the SelectManager's Tree's Combination member to a // ExceptNode of itself and the parameter `manager`'s Tree. func (self *SelectManager) Except(manager *SelectManager) *SelectManager { self.Tree.Combinator = nodes.Except(self.Tree, manager.Tree) return self }