diff options
Diffstat (limited to 'models/issue_label.go')
-rw-r--r-- | models/issue_label.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/models/issue_label.go b/models/issue_label.go index 1fc873cfd4..497756af5b 100644 --- a/models/issue_label.go +++ b/models/issue_label.go @@ -250,6 +250,19 @@ func GetLabelIDsInRepoByNames(repoID int64, labelNames []string) ([]int64, error Find(&labelIDs) } +// GetLabelIDsInReposByNames returns a list of labelIDs by names in one of the given +// repositories. +// it silently ignores label names that do not belong to the repository. +func GetLabelIDsInReposByNames(repoIDs []int64, labelNames []string) ([]int64, error) { + labelIDs := make([]int64, 0, len(labelNames)) + return labelIDs, x.Table("label"). + In("repo_id", repoIDs). + In("name", labelNames). + Asc("name"). + Cols("id"). + Find(&labelIDs) +} + // GetLabelInRepoByID returns a label by ID in given repository. func GetLabelInRepoByID(repoID, labelID int64) (*Label, error) { return getLabelInRepoByID(x, repoID, labelID) |