示例#1
0
func TestGmqFilters(t *testing.T) {
	left := gmq.UnitFilter("id", "=", 1)
	log.Println(left.SqlString("User"), left.Params())

	right := gmq.UnitFilter("name", "LIKE", "hello%")
	log.Println(right.SqlString("User"), right.Params())

	and := left.And(right)
	log.Println(and.SqlString("User"), and.Params())

	in := gmq.InFilter("id", []interface{}{10, 20, 30})
	log.Println(in.SqlString("User"), in.Params())

	or := and.Or(in)
	log.Println(or.SqlString("User"), or.Params())
}
示例#2
0
func (o _ColumnsObjs) newFilter(name, op string, params ...interface{}) gmq.Filter {
	if strings.ToUpper(op) == "IN" {
		return gmq.InFilter(name, params)
	}
	return gmq.UnitFilter(name, op, params[0])
}