diff options
author | Nanguan Lin <70063547+lng2020@users.noreply.github.com> | 2023-10-19 18:25:57 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-19 10:25:57 +0000 |
commit | e91d4f106b1f97abb06f3af9506f00a730357f9e (patch) | |
tree | 400625abf49deea2ba5d37d787592716c91a71c3 /models/unittest | |
parent | 2f2ca8c940a8d79426ac0ea2e2c61727ebd6204a (diff) | |
download | gitea-e91d4f106b1f97abb06f3af9506f00a730357f9e.tar.gz gitea-e91d4f106b1f97abb06f3af9506f00a730357f9e.zip |
Upgrade xorm (#27673)
Related to https://gitea.com/xorm/xorm/pulls/2341
Diffstat (limited to 'models/unittest')
-rw-r--r-- | models/unittest/unit_tests.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/models/unittest/unit_tests.go b/models/unittest/unit_tests.go index 399040580c..d47bceea1e 100644 --- a/models/unittest/unit_tests.go +++ b/models/unittest/unit_tests.go @@ -96,7 +96,15 @@ func AssertExistsAndLoadMap(t assert.TestingT, table string, conditions ...any) // GetCount get the count of a bean func GetCount(t assert.TestingT, bean any, conditions ...any) int { e := db.GetEngine(db.DefaultContext) - count, err := whereOrderConditions(e, conditions).Count(bean) + for _, condition := range conditions { + switch cond := condition.(type) { + case *testCond: + e = e.Where(cond.query, cond.args...) + default: + e = e.Where(cond) + } + } + count, err := e.Count(bean) assert.NoError(t, err) return int(count) } |