@@ -48,8 +48,7 @@ func GetTeamRepositories(ctx context.Context, opts *SearchTeamRepoOptions) (Repo
48
48
// accessible to a particular user
49
49
type AccessibleReposEnvironment interface {
50
50
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 )
53
52
MirrorRepos (ctx context.Context ) (RepositoryList , error )
54
53
AddKeyword (keyword string )
55
54
SetSort (db.SearchOrderBy )
@@ -132,40 +131,18 @@ func (env *accessibleReposEnv) CountRepos(ctx context.Context) (int64, error) {
132
131
return repoCount , nil
133
132
}
134
133
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
141
136
return repoIDs , db .GetEngine (ctx ).
142
137
Table ("repository" ).
143
138
Join ("INNER" , "team_repo" , "`team_repo`.repo_id=`repository`.id" ).
144
139
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 ]).
146
141
OrderBy (string (env .orderBy )).
147
- Limit (pageSize , (page - 1 )* pageSize ).
148
142
Cols ("`repository`.id" ).
149
143
Find (& repoIDs )
150
144
}
151
145
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
-
169
146
func (env * accessibleReposEnv ) MirrorRepoIDs (ctx context.Context ) ([]int64 , error ) {
170
147
repoIDs := make ([]int64 , 0 , 10 )
171
148
return repoIDs , db .GetEngine (ctx ).
0 commit comments