mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-02 16:35:19 +02:00
Penultimate round of db.DefaultContext
refactor (#27414)
Part of #27065 --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
parent
50166d1f7c
commit
ebe803e514
136 changed files with 428 additions and 421 deletions
|
@ -108,8 +108,8 @@ func GetLanguageStats(ctx context.Context, repo *Repository) (LanguageStatList,
|
|||
}
|
||||
|
||||
// GetTopLanguageStats returns the top language statistics for a repository
|
||||
func GetTopLanguageStats(repo *Repository, limit int) (LanguageStatList, error) {
|
||||
stats, err := GetLanguageStats(db.DefaultContext, repo)
|
||||
func GetTopLanguageStats(ctx context.Context, repo *Repository, limit int) (LanguageStatList, error) {
|
||||
stats, err := GetLanguageStats(ctx, repo)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -140,8 +140,8 @@ func GetTopLanguageStats(repo *Repository, limit int) (LanguageStatList, error)
|
|||
}
|
||||
|
||||
// UpdateLanguageStats updates the language statistics for repository
|
||||
func UpdateLanguageStats(repo *Repository, commitID string, stats map[string]int64) error {
|
||||
ctx, committer, err := db.TxContext(db.DefaultContext)
|
||||
func UpdateLanguageStats(ctx context.Context, repo *Repository, commitID string, stats map[string]int64) error {
|
||||
ctx, committer, err := db.TxContext(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -212,8 +212,8 @@ func UpdateLanguageStats(repo *Repository, commitID string, stats map[string]int
|
|||
}
|
||||
|
||||
// CopyLanguageStat Copy originalRepo language stat information to destRepo (use for forked repo)
|
||||
func CopyLanguageStat(originalRepo, destRepo *Repository) error {
|
||||
ctx, committer, err := db.TxContext(db.DefaultContext)
|
||||
func CopyLanguageStat(ctx context.Context, originalRepo, destRepo *Repository) error {
|
||||
ctx, committer, err := db.TxContext(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue