@@ -299,6 +299,9 @@ func GetLabelByID(ctx context.Context, labelID int64) (*Label, error) {
299
299
// GetLabelsByIDs returns a list of labels by IDs
300
300
func GetLabelsByIDs (ctx context.Context , labelIDs []int64 , cols ... string ) ([]* Label , error ) {
301
301
labels := make ([]* Label , 0 , len (labelIDs ))
302
+ if len (labelIDs ) == 0 {
303
+ return labels , nil
304
+ }
302
305
return labels , db .GetEngine (ctx ).Table ("label" ).
303
306
In ("id" , labelIDs ).
304
307
Asc ("name" ).
@@ -375,6 +378,9 @@ func BuildLabelNamesIssueIDsCondition(labelNames []string) *builder.Builder {
375
378
// it silently ignores label IDs that do not belong to the repository.
376
379
func GetLabelsInRepoByIDs (ctx context.Context , repoID int64 , labelIDs []int64 ) ([]* Label , error ) {
377
380
labels := make ([]* Label , 0 , len (labelIDs ))
381
+ if len (labelIDs ) == 0 {
382
+ return labels , nil
383
+ }
378
384
return labels , db .GetEngine (ctx ).
379
385
Where ("repo_id = ?" , repoID ).
380
386
In ("id" , labelIDs ).
@@ -447,6 +453,9 @@ func GetLabelInOrgByID(ctx context.Context, orgID, labelID int64) (*Label, error
447
453
// it silently ignores label IDs that do not belong to the organization.
448
454
func GetLabelsInOrgByIDs (ctx context.Context , orgID int64 , labelIDs []int64 ) ([]* Label , error ) {
449
455
labels := make ([]* Label , 0 , len (labelIDs ))
456
+ if len (labelIDs ) == 0 {
457
+ return labels , nil
458
+ }
450
459
return labels , db .GetEngine (ctx ).
451
460
Where ("org_id = ?" , orgID ).
452
461
In ("id" , labelIDs ).
0 commit comments