aboutsummaryrefslogtreecommitdiffstats
path: root/models/repo/repo.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-12-29 21:02:12 +0800
committerGitHub <noreply@github.com>2021-12-29 21:02:12 +0800
commit8ce1b539b1aaf242903b5b0c342dd592bd8da8d9 (patch)
tree455d363b51d69a9be4058961a16d5c43b7698f47 /models/repo/repo.go
parent8fa97a25f0dccc4db94d344ce7af632f8fe358b0 (diff)
downloadgitea-8ce1b539b1aaf242903b5b0c342dd592bd8da8d9.tar.gz
gitea-8ce1b539b1aaf242903b5b0c342dd592bd8da8d9.zip
Use conditions but not repo ids as query condition (#16839)
* Use conditions but not repo ids as query condition * Improve the performance of pulls/issue * Remove duplicated code * fix lint * Fix bug * Fix stats * More fixes * Fix build * Fix lint * Fix test * Fix build * Adjust the logic * Merge * Fix conflicts * improve the performance * Add comments for the query conditions functions * Some improvements
Diffstat (limited to 'models/repo/repo.go')
-rw-r--r--models/repo/repo.go31
1 files changed, 0 insertions, 31 deletions
diff --git a/models/repo/repo.go b/models/repo/repo.go
index d0136e9c66..5108231cd8 100644
--- a/models/repo/repo.go
+++ b/models/repo/repo.go
@@ -731,15 +731,6 @@ func CountUserRepositories(userID int64, private bool) int64 {
return countRepositories(userID, private)
}
-// GetUserMirrorRepositories returns a list of mirror repositories of given user.
-func GetUserMirrorRepositories(userID int64) ([]*Repository, error) {
- repos := make([]*Repository, 0, 10)
- return repos, db.GetEngine(db.DefaultContext).
- Where("owner_id = ?", userID).
- And("is_mirror = ?", true).
- Find(&repos)
-}
-
func getRepositoryCount(e db.Engine, ownerID int64) (int64, error) {
return e.Count(&Repository{OwnerID: ownerID})
}
@@ -766,25 +757,3 @@ func GetPublicRepositoryCount(u *user_model.User) (int64, error) {
func GetPrivateRepositoryCount(u *user_model.User) (int64, error) {
return getPrivateRepositoryCount(db.GetEngine(db.DefaultContext), u)
}
-
-// IterateRepository iterate repositories
-func IterateRepository(f func(repo *Repository) error) error {
- var start int
- batchSize := setting.Database.IterateBufferSize
- for {
- repos := make([]*Repository, 0, batchSize)
- if err := db.GetEngine(db.DefaultContext).Limit(batchSize, start).Find(&repos); err != nil {
- return err
- }
- if len(repos) == 0 {
- return nil
- }
- start += len(repos)
-
- for _, repo := range repos {
- if err := f(repo); err != nil {
- return err
- }
- }
- }
-}