mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08: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:
		@@ -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})
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user