mirror of
https://github.com/go-gitea/gitea.git
synced 2025-08-31 04:52:52 +09:00
Small refactor to reduce unnecessary database queries and remove duplicated functions (#33779)
This commit is contained in:
@ -839,6 +839,9 @@ func GetRepositoryByID(ctx context.Context, id int64) (*Repository, error) {
|
||||
// GetRepositoriesMapByIDs returns the repositories by given id slice.
|
||||
func GetRepositoriesMapByIDs(ctx context.Context, ids []int64) (map[int64]*Repository, error) {
|
||||
repos := make(map[int64]*Repository, len(ids))
|
||||
if len(ids) == 0 {
|
||||
return repos, nil
|
||||
}
|
||||
return repos, db.GetEngine(ctx).In("id", ids).Find(&repos)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user