예제 #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
파일: columns.go 프로젝트: jlovison/modelq
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])
}