1
0
mirror of https://github.com/astaxie/beego.git synced 2025-07-07 01:30:18 +00:00

resolves #2291, introduces AndNotCond/OrNotCond to orm.Condition

This commit is contained in:
Dusan Kasan
2016-11-28 09:49:06 +01:00
parent 24015e9ace
commit 34e2b26b99
2 changed files with 36 additions and 0 deletions

View File

@ -909,6 +909,16 @@ func TestSetCond(t *testing.T) {
num, err = qs.SetCond(cond2).Count()
throwFail(t, err)
throwFail(t, AssertIs(num, 2))
cond3 := cond.AndNotCond(cond.And("status__in", 1))
num, err = qs.SetCond(cond3).Count()
throwFail(t, err)
throwFail(t, AssertIs(num, 2))
cond4 := cond.And("user_name", "slene").OrNotCond(cond.And("user_name", "slene"))
num, err = qs.SetCond(cond4).Count()
throwFail(t, err)
throwFail(t, AssertIs(num, 3))
}
func TestLimit(t *testing.T) {