0
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-12-22 10:05:11 +01:00
gitea/models/git
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
..
branch_list.go Add container.FilterSlice function (#30339) 2024-04-09 20:27:30 +08:00
branch_test.go
branch.go Sync branches to DB immediately when handle git hook calling (#29493) 2024-03-06 16:47:52 +08:00
commit_status_test.go
commit_status.go Move from max( id ) to max( index ) for latest commit statuses (#30076) 2024-03-28 16:01:15 +08:00
lfs_lock.go
lfs.go
main_test.go
protected_banch_list_test.go
protected_branch_list.go
protected_branch_test.go
protected_branch.go
protected_tag_test.go
protected_tag.go