We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gitee 分页逻辑有问题,依旧只能查询到前 100 个仓库
Page is default 0
func (s *service) List(ctx context.Context, user *core.User) ([]*core.Repository, error) { err := s.renew.Renew(ctx, user, false) if err != nil { return nil, err } ctx = context.WithValue(ctx, scm.TokenKey{}, &scm.Token{ Token: user.Token, Refresh: user.Refresh, }) repos := []*core.Repository{} opts := scm.ListOptions{Size: 100} for { result, meta, err := s.client.Repositories.List(ctx, opts) if err != nil { return nil, err } for _, src := range result { if src != nil { repos = append(repos, convertRepository(src, s.visibility, s.trusted)) } } opts.Page = meta.Page.Next opts.URL = meta.Page.NextURL if opts.Page == 0 && opts.URL == "" { break } } return repos, nil }
func encodeListOptions(opts scm.ListOptions) string { params := url.Values{} if opts.Page != 0 { params.Set("page", strconv.Itoa(opts.Page)) } if opts.Size != 0 { params.Set("per_page", strconv.Itoa(opts.Size)) } return params.Encode() }
current always default value 0
So can't paginate the query
func populatePageValues(req *scm.Request, resp *scm.Response) { last, totalError := strconv.Atoi(resp.Header.Get("total_page")) reqURL, err := url.Parse(req.Path) if err != nil { return } current, currentError := strconv.Atoi(reqURL.Query().Get("page")) if totalError != nil && currentError != nil { return } resp.Page.First = 1 if last != 0 { resp.Page.Last = last } if current != 0 { if current < resp.Page.Last { resp.Page.Next = current + 1 } else { resp.Page.Next = resp.Page.Last } if current > resp.Page.First { resp.Page.Prev = current - 1 } else { resp.Page.Prev = resp.Page.First } } }
The text was updated successfully, but these errors were encountered:
@kit101
Sorry, something went wrong.
Hey @wmvm0 was your issue resolved?
No branches or pull requests
gitee 分页逻辑有问题,依旧只能查询到前 100 个仓库
Page is default 0
current always default value 0
So can't paginate the query
The text was updated successfully, but these errors were encountered: