mirror of
https://github.com/go-gitea/gitea
synced 2025-07-16 07:18:37 +00:00
Use subquery to instead In (#10874)
* Use subquery to instead In * Support excludedLabelNames on issues options * Fix tests Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
@@ -269,6 +269,17 @@ func GetLabelIDsInRepoByNames(repoID int64, labelNames []string) ([]int64, error
|
||||
Find(&labelIDs)
|
||||
}
|
||||
|
||||
// BuildLabelNamesIssueIDsCondition returns a builder where get issue ids match label names
|
||||
func BuildLabelNamesIssueIDsCondition(labelNames []string) *builder.Builder {
|
||||
return builder.Select("issue_label.issue_id").
|
||||
From("issue_label").
|
||||
InnerJoin("label", "label.id = issue_label.label_id").
|
||||
Where(
|
||||
builder.In("label.name", labelNames),
|
||||
).
|
||||
GroupBy("issue_label.issue_id")
|
||||
}
|
||||
|
||||
// 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.
|
||||
|
Reference in New Issue
Block a user