Skip to content

Commit

Permalink
feat(gorm/scope): Added scope method
Browse files Browse the repository at this point in the history
Signed-off-by: Flc゛ <[email protected]>
  • Loading branch information
flc1125 committed Feb 23, 2024
1 parent b727f25 commit eb972e0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion gorm/scopes/where_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit eb972e0

Please sign in to comment.