0
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-02-01 09:07:35 +01:00
gitea/models/issues
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
..
assignees_test.go
assignees.go
comment_code.go Load attachments for code comments (#30124) 2024-03-27 04:44:26 +00:00
comment_list.go Add container.FilterSlice function (#30339) 2024-04-09 20:27:30 +08:00
comment_test.go
comment.go Add container.FilterSlice function (#30339) 2024-04-09 20:27:30 +08:00
content_history_test.go
content_history.go
dependency_test.go
dependency.go
issue_index.go
issue_label_test.go
issue_label.go
issue_list_test.go
issue_list.go Add container.FilterSlice function (#30339) 2024-04-09 20:27:30 +08:00
issue_lock.go
issue_project.go Add default board to new projects, remove uncategorized pseudo-board (#29874) 2024-03-27 20:54:32 +00:00
issue_search.go Use db.ListOptions directly instead of Paginator interface to make it easier to use and fix performance of /pulls and /issues (#29990) 2024-03-24 18:51:08 +00:00
issue_stats.go Use db.ListOptions directly instead of Paginator interface to make it easier to use and fix performance of /pulls and /issues (#29990) 2024-03-24 18:51:08 +00:00
issue_test.go
issue_update.go
issue_user_test.go
issue_user.go
issue_watch_test.go
issue_watch.go
issue_xref_test.go
issue_xref.go
issue.go
label_test.go
label.go
main_test.go
milestone_list.go
milestone_test.go
milestone.go
pull_list.go
pull_test.go
pull.go
reaction.go Add container.FilterSlice function (#30339) 2024-04-09 20:27:30 +08:00
review_list.go Add container.FilterSlice function (#30339) 2024-04-09 20:27:30 +08:00
review_test.go Prevent re-review and dismiss review actions on closed and merged PRs (#30065) 2024-03-28 15:19:24 +00:00
review.go Prevent re-review and dismiss review actions on closed and merged PRs (#30065) 2024-03-28 15:19:24 +00:00
stopwatch_test.go
stopwatch.go
tracked_time_test.go
tracked_time.go