mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-28 21:00:03 +02: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:
parent
5c3be56f7b
commit
f490291bea
3 changed files with 45 additions and 26 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue