klesh commented on code in PR #3986:
URL:
https://github.com/apache/incubator-devlake/pull/3986#discussion_r1053929472
##########
services/dm_code.go:
##########
@@ -20,20 +20,12 @@ package services
import (
"github.com/apache/incubator-devlake/errors"
"github.com/apache/incubator-devlake/models/domainlayer/code"
+ "github.com/apache/incubator-devlake/plugins/core/dal"
)
// GetRepos FIXME ...
func GetRepos() ([]*code.Repo, int64, errors.Error) {
repos := make([]*code.Repo, 0)
- db := db.Model(repos).Order("id DESC")
- var count int64
- err := db.Count(&count).Error
- if err != nil {
- return nil, 0, errors.Convert(err)
- }
- err = db.Find(&repos).Error
- if err != nil {
- return nil, count, errors.Convert(err)
- }
- return repos, count, nil
+ err := db.All(&repos, dal.Orderby("id DESC"))
+ return repos, int64(len(repos)), err
Review Comment:
not really sure what this API does, it was the original logic
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]