1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-12-04 14:46:57 -05: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 More db.DefaultContext refactor (#27265) 2023-09-29 12:12:54 +00:00
action.go Some performance optimization on dashboard and issues page (#29010) 2024-03-12 04:57:19 +00:00
main_test.go make writing main test easier (#27270) 2023-09-28 01:38:53 +00:00
notification_list.go Performance improvements for pull request list page (#29900) 2024-03-21 14:13:08 +01:00
notification_test.go Use db.Find instead of writing methods for every object (#28084) 2023-11-24 03:49:41 +00:00
notification.go Move notifications to a standalone file (#29930) 2024-03-20 10:28:35 +00:00
repo_activity.go Simplify how git repositories are opened (#28937) 2024-01-27 21:09:51 +01:00
statistic.go Add more stats tables (#29730) 2024-03-12 11:21:09 +00:00
user_heatmap_test.go Refactor timeutil package (#28623) 2023-12-28 10:09:57 +00:00
user_heatmap.go More db.DefaultContext refactor (#27265) 2023-09-29 12:12:54 +00:00