Upgrade xorm (#27673)
Related to https://gitea.com/xorm/xorm/pulls/2341
This commit is contained in:
parent
2f2ca8c940
commit
e91d4f106b
4 changed files with 13 additions and 5 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue