Add AbsoluteListOptions
(#17028)
This PR adds a `ListOptions` type which is not paged but uses absolute values. It is implemented as discussed in Discord. Extracted from #16510 to clean that PR.
This commit is contained in:
parent
0a542dd59f
commit
87505a9464
29 changed files with 161 additions and 58 deletions
|
@ -1770,7 +1770,7 @@ func GetUserRepositories(opts *SearchRepoOptions) ([]*Repository, int64, error)
|
|||
|
||||
sess.Where(cond).OrderBy(opts.OrderBy.String())
|
||||
repos := make([]*Repository, 0, opts.PageSize)
|
||||
return repos, count, opts.setSessionPagination(sess).Find(&repos)
|
||||
return repos, count, setSessionPagination(sess, opts).Find(&repos)
|
||||
}
|
||||
|
||||
// GetUserMirrorRepositories returns a list of mirror repositories of given user.
|
||||
|
@ -2061,7 +2061,7 @@ func (repo *Repository) GetForks(listOptions ListOptions) ([]*Repository, error)
|
|||
return forks, x.Find(&forks, &Repository{ForkID: repo.ID})
|
||||
}
|
||||
|
||||
sess := listOptions.getPaginatedSession()
|
||||
sess := getPaginatedSession(&listOptions)
|
||||
forks := make([]*Repository, 0, listOptions.PageSize)
|
||||
return forks, sess.Find(&forks, &Repository{ForkID: repo.ID})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue