func TestGrouping(t *testing.T) {
	grouping := nodes.Grouping(1)
	expected := "(1)"
	if got, _ := sql.Accept(grouping); expected != got {
		t.Errorf("TestGrouping was expected to return %s, got %s", expected, got)
	}
}
Example #2
0
// Appends an expression to the current Context's Wheres slice,
// typically a comparison, i.e. 1 = 1
func (self *SelectManager) Where(expr interface{}) *SelectManager {
	if _, ok := expr.(string); ok {
		expr = nodes.Literal(expr)
	}

	self.Context.Wheres = append(self.Context.Wheres, nodes.Grouping(expr))
	return self
}