forked from forgejo/forgejo
Second part of refactor db.Find
(#28194)
Continue of #27798 and move more functions to `db.Find` and `db.Count`.
This commit is contained in:
parent
0abb5633e3
commit
537fa69962
14 changed files with 149 additions and 222 deletions
|
@ -66,22 +66,17 @@ func LoadBranches(ctx context.Context, repo *repo_model.Repository, gitRepo *git
|
|||
Keyword: keyword,
|
||||
}
|
||||
|
||||
totalNumOfBranches, err := git_model.CountBranches(ctx, branchOpts)
|
||||
dbBranches, totalNumOfBranches, err := db.FindAndCount[git_model.Branch](ctx, branchOpts)
|
||||
if err != nil {
|
||||
return nil, nil, 0, err
|
||||
}
|
||||
|
||||
branchOpts.ExcludeBranchNames = []string{repo.DefaultBranch}
|
||||
|
||||
dbBranches, err := git_model.FindBranches(ctx, branchOpts)
|
||||
if err != nil {
|
||||
if err := git_model.BranchList(dbBranches).LoadDeletedBy(ctx); err != nil {
|
||||
return nil, nil, 0, err
|
||||
}
|
||||
|
||||
if err := dbBranches.LoadDeletedBy(ctx); err != nil {
|
||||
return nil, nil, 0, err
|
||||
}
|
||||
if err := dbBranches.LoadPusher(ctx); err != nil {
|
||||
if err := git_model.BranchList(dbBranches).LoadPusher(ctx); err != nil {
|
||||
return nil, nil, 0, err
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue