mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-04 05:18:25 +00:00 
			
		
		
		
	Upgrade xorm (#27673)
Related to https://gitea.com/xorm/xorm/pulls/2341
This commit is contained in:
		@@ -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)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user