1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-16 07:18:37 +00:00

Small refactor to reduce unnecessary database queries and remove duplicated functions (#33779)

This commit is contained in:
Lunny Xiao
2025-03-04 10:25:20 -08:00
committed by GitHub
parent 75e85c25c1
commit 6c8fb8d455
10 changed files with 32 additions and 12 deletions

View File

@@ -595,6 +595,9 @@ func GetIssueByID(ctx context.Context, id int64) (*Issue, error) {
// If keepOrder is true, the order of the returned issues will be the same as the given IDs.
func GetIssuesByIDs(ctx context.Context, issueIDs []int64, keepOrder ...bool) (IssueList, error) {
issues := make([]*Issue, 0, len(issueIDs))
if len(issueIDs) == 0 {
return issues, nil
}
if err := db.GetEngine(ctx).In("id", issueIDs).Find(&issues); err != nil {
return nil, err