This PR will avoid load pullrequest.Issue twice in pull request list page. It will reduce x times database queries for those WIP pull requests. Partially fix #29585 Backport #29900
This commit is contained in:
parent
c03b1e2854
commit
6ef986d474
14 changed files with 85 additions and 49 deletions
|
@ -45,3 +45,12 @@ func SliceSortedEqual[T comparable](s1, s2 []T) bool {
|
|||
func SliceRemoveAll[T comparable](slice []T, target T) []T {
|
||||
return slices.DeleteFunc(slice, func(t T) bool { return t == target })
|
||||
}
|
||||
|
||||
// TODO: Replace with "maps.Keys" once available, current it only in golang.org/x/exp/maps but not in standard library
|
||||
func KeysOfMap[K comparable, V any](m map[K]V) []K {
|
||||
keys := make([]K, 0, len(m))
|
||||
for k := range m {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
return keys
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue