Move almost all functions' parameter db.Engine to context.Context (#19748)
* Move almost all functions' parameter db.Engine to context.Context * remove some unnecessary wrap functions
This commit is contained in:
parent
d81e31ad78
commit
fd7d83ace6
232 changed files with 1463 additions and 2108 deletions
|
@ -365,7 +365,7 @@ func Generate(ctx *context.APIContext) {
|
|||
ctxUser := ctx.Doer
|
||||
var err error
|
||||
if form.Owner != ctxUser.Name {
|
||||
ctxUser, err = user_model.GetUserByName(form.Owner)
|
||||
ctxUser, err = user_model.GetUserByName(ctx, form.Owner)
|
||||
if err != nil {
|
||||
if user_model.IsErrUserNotExist(err) {
|
||||
ctx.JSON(http.StatusNotFound, map[string]interface{}{
|
||||
|
@ -962,7 +962,7 @@ func updateMirror(ctx *context.APIContext, opts api.EditRepoOption) error {
|
|||
}
|
||||
|
||||
// get the mirror from the repo
|
||||
mirror, err := repo_model.GetMirrorByRepoID(repo.ID)
|
||||
mirror, err := repo_model.GetMirrorByRepoID(ctx, repo.ID)
|
||||
if err != nil {
|
||||
log.Error("Failed to get mirror: %s", err)
|
||||
ctx.Error(http.StatusInternalServerError, "MirrorInterval", err)
|
||||
|
@ -1000,7 +1000,7 @@ func updateMirror(ctx *context.APIContext, opts api.EditRepoOption) error {
|
|||
}
|
||||
|
||||
// finally update the mirror in the DB
|
||||
if err := repo_model.UpdateMirror(mirror); err != nil {
|
||||
if err := repo_model.UpdateMirror(ctx, mirror); err != nil {
|
||||
log.Error("Failed to Set Mirror Interval: %s", err)
|
||||
ctx.Error(http.StatusUnprocessableEntity, "MirrorInterval", err)
|
||||
return err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue