From eb972e0611d3d0856d68def45a22e7d9e522348a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Flc=E3=82=9B?= Date: Fri, 23 Feb 2024 23:34:02 +0800 Subject: [PATCH] feat(gorm/scope): Added scope method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Flcă‚› --- gorm/scopes/where_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gorm/scopes/where_test.go b/gorm/scopes/where_test.go index ad999833..1903edf9 100644 --- a/gorm/scopes/where_test.go +++ b/gorm/scopes/where_test.go @@ -35,10 +35,11 @@ func TestWhere_Between(t *testing.T) { GetUser("WhereBetweenUser3", GetUserOptions{Age: 22}), } + DB.Session(&gorm.Session{AllowGlobalUpdate: true}).Delete(&User{}) DB.Create(&users) var users1, users2, users3 []User - DB.Debug().Scopes(WhereBetween("age", 18, 20).Scope()).Find(&users1) + DB.Scopes(WhereBetween("age", 18, 20).Scope()).Find(&users1) assert.Len(t, users1, 2) DB.Scopes(WhereBetween("age", 18, 19).Scope()).Find(&users2)