···269269// DecrByIDs decreases the given column for entities of the "bean" type with one of the given ids by one
270270// Timestamps of the entities won't be updated
271271func DecrByIDs(ctx context.Context, ids []int64, decrCol string, bean any) error {
272272+ if len(ids) == 0 {
273273+ return nil
274274+ }
272275 _, err := GetEngine(ctx).Decr(decrCol).In("id", ids).NoAutoCondition().NoAutoTime().Update(bean)
273276 return err
274277}
+3
models/issues/issue.go
···546546// If keepOrder is true, the order of the returned issues will be the same as the given IDs.
547547func GetIssuesByIDs(ctx context.Context, issueIDs []int64, keepOrder ...bool) (IssueList, error) {
548548 issues := make([]*Issue, 0, len(issueIDs))
549549+ if len(issueIDs) == 0 {
550550+ return issues, nil
551551+ }
549552550553 if err := db.GetEngine(ctx).In("id", issueIDs).Find(&issues); err != nil {
551554 return nil, err
+9
models/issues/label.go
···303303// GetLabelsByIDs returns a list of labels by IDs
304304func GetLabelsByIDs(ctx context.Context, labelIDs []int64, cols ...string) ([]*Label, error) {
305305 labels := make([]*Label, 0, len(labelIDs))
306306+ if len(labelIDs) == 0 {
307307+ return labels, nil
308308+ }
306309 return labels, db.GetEngine(ctx).Table("label").
307310 In("id", labelIDs).
308311 Asc("name").
···379382// it silently ignores label IDs that do not belong to the repository.
380383func GetLabelsInRepoByIDs(ctx context.Context, repoID int64, labelIDs []int64) ([]*Label, error) {
381384 labels := make([]*Label, 0, len(labelIDs))
385385+ if len(labelIDs) == 0 {
386386+ return labels, nil
387387+ }
382388 return labels, db.GetEngine(ctx).
383389 Where("repo_id = ?", repoID).
384390 In("id", labelIDs).
···451457// it silently ignores label IDs that do not belong to the organization.
452458func GetLabelsInOrgByIDs(ctx context.Context, orgID int64, labelIDs []int64) ([]*Label, error) {
453459 labels := make([]*Label, 0, len(labelIDs))
460460+ if len(labelIDs) == 0 {
461461+ return labels, nil
462462+ }
454463 return labels, db.GetEngine(ctx).
455464 Where("org_id = ?", orgID).
456465 In("id", labelIDs).