Add Count test with order by scope
This commit is contained in:
parent
9b2181199d
commit
9ff9be09c1
@ -36,6 +36,10 @@ func TestCount(t *testing.T) {
|
||||
t.Errorf("Count() method should get correct value, expect: %v, got %v", count, len(users))
|
||||
}
|
||||
|
||||
if err := DB.Model(&User{}).Where("name = ?", user1.Name).Order("id desc").Count(&count).Find(&users).Error; err != nil {
|
||||
t.Errorf(fmt.Sprintf("Count with order by should work, but got err %v", err))
|
||||
}
|
||||
|
||||
DB.Model(&User{}).Where("name = ?", user1.Name).Count(&count1).Or("name in ?", []string{user2.Name, user3.Name}).Count(&count2)
|
||||
if count1 != 1 || count2 != 3 {
|
||||
t.Errorf("multiple count in chain should works")
|
||||
|
Loading…
x
Reference in New Issue
Block a user