go-common/app/interface/main/mcn/tool/datacenter/sqltool_test.go
2019-04-22 18:49:16 +08:00

35 lines
623 B
Go

package datacenter
import "testing"
func TestSelect(t *testing.T) {
var q = &Query{}
q.Select("a,b b2,c as c2")
t.Logf("query=%s", q)
q = &Query{}
q.Select(" * ")
t.Logf("query=%s", q)
}
func TestWhere(t *testing.T) {
var q = &Query{}
q.Select("a,b,c as yeah").Where(
ConditionMapType{
"field1": ConditionIn(1, 2, 3, 4),
"field3": ConditionIn("OK"),
},
ConditionMapType{
"field2": ConditionGt(100),
},
ConditionMapType{
"field1": ConditionGte(100),
})
t.Logf("query=%s", q)
}
func TestSort(t *testing.T) {
var q = &Query{}
q.Order("field1 desc, field2")
t.Logf("query=%s", q)
}