mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 20:02:09 +00:00
Small refactor to reduce unnecessary database queries and remove duplicated functions (#33779)
(cherry picked from commit 6c8fb8d455cfe25d5aa966674624bce99fba1735)
This commit is contained in:
parent
49694242d4
commit
0a52be2a04
6 changed files with 22 additions and 7 deletions
|
@ -546,6 +546,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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue