]> source.dussan.org Git - gitea.git/commitdiff
Upgrade xorm (#27673)
authorNanguan Lin <70063547+lng2020@users.noreply.github.com>
Thu, 19 Oct 2023 10:25:57 +0000 (18:25 +0800)
committerGitHub <noreply@github.com>
Thu, 19 Oct 2023 10:25:57 +0000 (10:25 +0000)
Related to https://gitea.com/xorm/xorm/pulls/2341

go.mod
go.sum
models/git/commit_status.go
models/unittest/unit_tests.go

diff --git a/go.mod b/go.mod
index 23474cd7e12adf03e2e38065d2ebe7c9909ec67d..84f42969d50e5beda973a64126a0de4c5acf4f9b 100644 (file)
--- a/go.mod
+++ b/go.mod
@@ -121,7 +121,7 @@ require (
        mvdan.cc/xurls/v2 v2.5.0
        strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251
        xorm.io/builder v0.3.13
-       xorm.io/xorm v1.3.3
+       xorm.io/xorm v1.3.4-0.20231017094142-dbe499091a7e
 )
 
 require (
diff --git a/go.sum b/go.sum
index ec9527760cc5d4e1917d7d37aa3a7cda488b0a16..379533b08ced69e5e626dcfe05e796700924a2a7 100644 (file)
--- a/go.sum
+++ b/go.sum
@@ -1648,5 +1648,5 @@ strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251/go.mod h1:
 xorm.io/builder v0.3.11-0.20220531020008-1bd24a7dc978/go.mod h1:aUW0S9eb9VCaPohFCH3j7czOx1PMW3i1HrSzbLYGBSE=
 xorm.io/builder v0.3.13 h1:a3jmiVVL19psGeXx8GIurTp7p0IIgqeDmwhcR6BAOAo=
 xorm.io/builder v0.3.13/go.mod h1:aUW0S9eb9VCaPohFCH3j7czOx1PMW3i1HrSzbLYGBSE=
-xorm.io/xorm v1.3.3 h1:L5/GOhvgMcwJYYRjzPf3lTTTf6JcaTd1Mb9A/Iqvccw=
-xorm.io/xorm v1.3.3/go.mod h1:qFJGFoVYbbIdnz2vaL5OxSQ2raleMpyRRalnq3n9OJo=
+xorm.io/xorm v1.3.4-0.20231017094142-dbe499091a7e h1:oL+ktEW+iSrCXU6IauJ9csZFATEmawkhsq/MAoHTdwo=
+xorm.io/xorm v1.3.4-0.20231017094142-dbe499091a7e/go.mod h1:qFJGFoVYbbIdnz2vaL5OxSQ2raleMpyRRalnq3n9OJo=
index acb011020056efa5fe3349f7b90f2f0d700631d9..c6a52bcd9f5b503ff3f7309927895c9f52d04df4 100644 (file)
@@ -235,7 +235,7 @@ func GetCommitStatuses(ctx context.Context, repo *repo_model.Repository, sha str
 
        countSession := listCommitStatusesStatement(ctx, repo, sha, opts)
        countSession = db.SetSessionPagination(countSession, opts)
-       maxResults, err := countSession.Count(new(CommitStatus))
+       maxResults, err := countSession.OrderBy("1").Count(new(CommitStatus))
        if err != nil {
                log.Error("Count PRs: %v", err)
                return nil, maxResults, err
index 399040580cdcb4792a417117067f2d636af727aa..d47bceea1ea1358b9ed0083322529a9080b95e18 100644 (file)
@@ -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)
 }