Skip to content

Commit 89d3766

Browse files
GiteaBotlng2020
andauthored
Upgrade xorm (#27673) (#27691)
Backport #27673 by @lng2020 Related to https://gitea.com/xorm/xorm/pulls/2341 Co-authored-by: Nanguan Lin <[email protected]>
1 parent 9b14f1a commit 89d3766

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ require (
121121
mvdan.cc/xurls/v2 v2.5.0
122122
strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251
123123
xorm.io/builder v0.3.13
124-
xorm.io/xorm v1.3.3
124+
xorm.io/xorm v1.3.4-0.20231017094142-dbe499091a7e
125125
)
126126

127127
require (

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,5 +1648,5 @@ strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251/go.mod h1:
16481648
xorm.io/builder v0.3.11-0.20220531020008-1bd24a7dc978/go.mod h1:aUW0S9eb9VCaPohFCH3j7czOx1PMW3i1HrSzbLYGBSE=
16491649
xorm.io/builder v0.3.13 h1:a3jmiVVL19psGeXx8GIurTp7p0IIgqeDmwhcR6BAOAo=
16501650
xorm.io/builder v0.3.13/go.mod h1:aUW0S9eb9VCaPohFCH3j7czOx1PMW3i1HrSzbLYGBSE=
1651-
xorm.io/xorm v1.3.3 h1:L5/GOhvgMcwJYYRjzPf3lTTTf6JcaTd1Mb9A/Iqvccw=
1652-
xorm.io/xorm v1.3.3/go.mod h1:qFJGFoVYbbIdnz2vaL5OxSQ2raleMpyRRalnq3n9OJo=
1651+
xorm.io/xorm v1.3.4-0.20231017094142-dbe499091a7e h1:oL+ktEW+iSrCXU6IauJ9csZFATEmawkhsq/MAoHTdwo=
1652+
xorm.io/xorm v1.3.4-0.20231017094142-dbe499091a7e/go.mod h1:qFJGFoVYbbIdnz2vaL5OxSQ2raleMpyRRalnq3n9OJo=

models/git/commit_status.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ func GetCommitStatuses(ctx context.Context, repo *repo_model.Repository, sha str
235235

236236
countSession := listCommitStatusesStatement(ctx, repo, sha, opts)
237237
countSession = db.SetSessionPagination(countSession, opts)
238-
maxResults, err := countSession.Count(new(CommitStatus))
238+
maxResults, err := countSession.OrderBy("1").Count(new(CommitStatus))
239239
if err != nil {
240240
log.Error("Count PRs: %v", err)
241241
return nil, maxResults, err

models/unittest/unit_tests.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,15 @@ func AssertExistsAndLoadMap(t assert.TestingT, table string, conditions ...any)
9696
// GetCount get the count of a bean
9797
func GetCount(t assert.TestingT, bean any, conditions ...any) int {
9898
e := db.GetEngine(db.DefaultContext)
99-
count, err := whereOrderConditions(e, conditions).Count(bean)
99+
for _, condition := range conditions {
100+
switch cond := condition.(type) {
101+
case *testCond:
102+
e = e.Where(cond.query, cond.args...)
103+
default:
104+
e = e.Where(cond)
105+
}
106+
}
107+
count, err := e.Count(bean)
100108
assert.NoError(t, err)
101109
return int(count)
102110
}

0 commit comments

Comments
 (0)