mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 02:46:04 +01:00 
			
		
		
		
	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:
		| @@ -97,7 +97,7 @@ func GetCommitStatuses(repo *Repository, sha string, opts *CommitStatusOptions) | ||||
| 	} | ||||
|  | ||||
| 	countSession := listCommitStatusesStatement(repo, sha, opts) | ||||
| 	countSession = opts.setSessionPagination(countSession) | ||||
| 	countSession = setSessionPagination(countSession, opts) | ||||
| 	maxResults, err := countSession.Count(new(CommitStatus)) | ||||
| 	if err != nil { | ||||
| 		log.Error("Count PRs: %v", err) | ||||
| @@ -106,7 +106,7 @@ func GetCommitStatuses(repo *Repository, sha string, opts *CommitStatusOptions) | ||||
|  | ||||
| 	statuses := make([]*CommitStatus, 0, opts.PageSize) | ||||
| 	findSession := listCommitStatusesStatement(repo, sha, opts) | ||||
| 	findSession = opts.setSessionPagination(findSession) | ||||
| 	findSession = setSessionPagination(findSession, opts) | ||||
| 	sortCommitStatusesSession(findSession, opts.SortType) | ||||
| 	return statuses, maxResults, findSession.Find(&statuses) | ||||
| } | ||||
| @@ -149,7 +149,7 @@ func getLatestCommitStatus(e Engine, repoID int64, sha string, listOptions ListO | ||||
| 		Select("max( id ) as id"). | ||||
| 		GroupBy("context_hash").OrderBy("max( id ) desc") | ||||
|  | ||||
| 	sess = listOptions.setSessionPagination(sess) | ||||
| 	sess = setSessionPagination(sess, &listOptions) | ||||
|  | ||||
| 	err := sess.Find(&ids) | ||||
| 	if err != nil { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user