Skip to content

Commit c948388

Browse files
authored
Revert "feat: [#646] The Where function of Orm supports func condition (#975)"
This reverts commit 12808d1.
1 parent 47e6f78 commit c948388

File tree

2 files changed

+0
-13
lines changed

2 files changed

+0
-13
lines changed

database/gorm/query.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -924,13 +924,6 @@ func (r *Query) UpdateOrCreate(dest any, attributes any, values any) error {
924924

925925
func (r *Query) Where(query any, args ...any) contractsorm.Query {
926926
conditions := r.conditions
927-
928-
if scope, ok := query.(func(contractsorm.Query) contractsorm.Query); ok {
929-
conditions.scopes = append(r.conditions.scopes, scope)
930-
931-
return r.setConditions(conditions)
932-
}
933-
934927
conditions.where = append(r.conditions.where, Where{
935928
query: query,
936929
args: args,

tests/query_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3212,12 +3212,6 @@ func (s *QueryTestSuite) TestWhere() {
32123212
var user4 User
32133213
s.Nil(query.Query().Where("name", "where_user").Find(&user4))
32143214
s.True(user4.ID > 0)
3215-
3216-
var user5 User
3217-
s.Nil(query.Query().Where(func(query contractsorm.Query) contractsorm.Query {
3218-
return query.Where("name = ?", "where_user")
3219-
}).Find(&user5))
3220-
s.True(user5.ID > 0)
32213215
})
32223216
}
32233217
}

0 commit comments

Comments
 (0)