@@ -48,8 +48,7 @@ func GetTeamRepositories(ctx context.Context, opts *SearchTeamRepoOptions) (Repo
4848// accessible to a particular user
4949type AccessibleReposEnvironment interface {
5050 CountRepos (ctx context.Context ) (int64 , error )
51- RepoIDs (ctx context.Context , page , pageSize int ) ([]int64 , error )
52- Repos (ctx context.Context , page , pageSize int ) (RepositoryList , error )
51+ RepoIDs (ctx context.Context ) ([]int64 , error )
5352 MirrorRepos (ctx context.Context ) (RepositoryList , error )
5453 AddKeyword (keyword string )
5554 SetSort (db.SearchOrderBy )
@@ -132,40 +131,18 @@ func (env *accessibleReposEnv) CountRepos(ctx context.Context) (int64, error) {
132131 return repoCount , nil
133132}
134133
135- func (env * accessibleReposEnv ) RepoIDs (ctx context.Context , page , pageSize int ) ([]int64 , error ) {
136- if page <= 0 {
137- page = 1
138- }
139-
140- repoIDs := make ([]int64 , 0 , pageSize )
134+ func (env * accessibleReposEnv ) RepoIDs (ctx context.Context ) ([]int64 , error ) {
135+ var repoIDs []int64
141136 return repoIDs , db .GetEngine (ctx ).
142137 Table ("repository" ).
143138 Join ("INNER" , "team_repo" , "`team_repo`.repo_id=`repository`.id" ).
144139 Where (env .cond ()).
145- GroupBy ("`repository`.id,`repository`." + strings .Fields (string (env .orderBy ))[0 ]).
140+ GroupBy ("`repository`.id,`repository`." + strings .Fields (string (env .orderBy ))[0 ]).
146141 OrderBy (string (env .orderBy )).
147- Limit (pageSize , (page - 1 )* pageSize ).
148142 Cols ("`repository`.id" ).
149143 Find (& repoIDs )
150144}
151145
152- func (env * accessibleReposEnv ) Repos (ctx context.Context , page , pageSize int ) (RepositoryList , error ) {
153- repoIDs , err := env .RepoIDs (ctx , page , pageSize )
154- if err != nil {
155- return nil , fmt .Errorf ("GetUserRepositoryIDs: %w" , err )
156- }
157-
158- repos := make ([]* Repository , 0 , len (repoIDs ))
159- if len (repoIDs ) == 0 {
160- return repos , nil
161- }
162-
163- return repos , db .GetEngine (ctx ).
164- In ("`repository`.id" , repoIDs ).
165- OrderBy (string (env .orderBy )).
166- Find (& repos )
167- }
168-
169146func (env * accessibleReposEnv ) MirrorRepoIDs (ctx context.Context ) ([]int64 , error ) {
170147 repoIDs := make ([]int64 , 0 , 10 )
171148 return repoIDs , db .GetEngine (ctx ).
0 commit comments