1
1
mirror of https://github.com/go-gitea/gitea synced 2025-01-18 13:44:27 +00:00
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
..
2024-03-04 08:16:03 +00:00
2024-04-07 19:17:06 +08:00
2023-12-25 21:25:29 +01:00
2024-03-04 08:16:03 +00:00
2024-03-04 20:49:21 +00:00
2024-03-04 08:16:03 +00:00
2024-03-04 08:16:03 +00:00
2023-12-25 21:25:29 +01:00
2024-03-04 08:16:03 +00:00
2024-03-04 08:16:03 +00:00
2024-03-04 08:16:03 +00:00
2024-03-04 08:16:03 +00:00