0
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-02-01 09:07:35 +01:00
gitea/models/activities
oliverpool d547b53cca
Add container.FilterSlice function (#30339)
Many places have the following logic:
```go
func (jobs ActionJobList) GetRunIDs() []int64 {
	ids := make(container.Set[int64], len(jobs))
	for _, j := range jobs {
		if j.RunID == 0 {
			continue
		}
		ids.Add(j.RunID)
	}
	return ids.Values()
}
```

this introduces a `container.FilterMapUnique` function, which reduces
the code above to:
```go
func (jobs ActionJobList) GetRunIDs() []int64 {
	return container.FilterMapUnique(jobs, func(j *ActionRunJob) (int64, bool) {
		return j.RunID, j.RunID != 0
	})
}
```
2024-04-09 20:27:30 +08:00
..
action_list.go Add container.FilterSlice function (#30339) 2024-04-09 20:27:30 +08:00
action_test.go
action.go Some performance optimization on dashboard and issues page (#29010) 2024-03-12 04:57:19 +00:00
main_test.go
notification_list.go Performance improvements for pull request list page (#29900) 2024-03-21 14:13:08 +01:00
notification_test.go
notification.go Move notifications to a standalone file (#29930) 2024-03-20 10:28:35 +00:00
repo_activity.go
statistic.go Add more stats tables (#29730) 2024-03-12 11:21:09 +00:00
user_heatmap_test.go
user_heatmap.go