diff options
Diffstat (limited to 'models/repo_list.go')
-rw-r--r-- | models/repo_list.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/models/repo_list.go b/models/repo_list.go index 883e3b98d5..d13266f208 100644 --- a/models/repo_list.go +++ b/models/repo_list.go @@ -16,6 +16,18 @@ import ( // RepositoryList contains a list of repositories type RepositoryList []*Repository +func (repos RepositoryList) Len() int { + return len(repos) +} + +func (repos RepositoryList) Less(i, j int) bool { + return repos[i].FullName() < repos[j].FullName() +} + +func (repos RepositoryList) Swap(i, j int) { + repos[i], repos[j] = repos[j], repos[i] +} + // RepositoryListOfMap make list from values of map func RepositoryListOfMap(repoMap map[int64]*Repository) RepositoryList { return RepositoryList(valuesRepository(repoMap)) |