mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
DBContext is just a Context (#17100)
* DBContext is just a Context This PR removes some of the specialness from the DBContext and makes it context This allows us to simplify the GetEngine code to wrap around any context in future and means that we can change our loadRepo(e Engine) functions to simply take contexts. Signed-off-by: Andrew Thornton <art27@cantab.net> * fix unit tests Signed-off-by: Andrew Thornton <art27@cantab.net> * another place that needs to set the initial context Signed-off-by: Andrew Thornton <art27@cantab.net> * avoid race Signed-off-by: Andrew Thornton <art27@cantab.net> * change attachment error Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
@@ -526,20 +526,20 @@ func (comments CommentList) loadAttributes(e db.Engine) (err error) {
|
||||
// LoadAttributes loads attributes of the comments, except for attachments and
|
||||
// comments
|
||||
func (comments CommentList) LoadAttributes() error {
|
||||
return comments.loadAttributes(db.DefaultContext().Engine())
|
||||
return comments.loadAttributes(db.GetEngine(db.DefaultContext))
|
||||
}
|
||||
|
||||
// LoadAttachments loads attachments
|
||||
func (comments CommentList) LoadAttachments() error {
|
||||
return comments.loadAttachments(db.DefaultContext().Engine())
|
||||
return comments.loadAttachments(db.GetEngine(db.DefaultContext))
|
||||
}
|
||||
|
||||
// LoadPosters loads posters
|
||||
func (comments CommentList) LoadPosters() error {
|
||||
return comments.loadPosters(db.DefaultContext().Engine())
|
||||
return comments.loadPosters(db.GetEngine(db.DefaultContext))
|
||||
}
|
||||
|
||||
// LoadIssues loads issues of comments
|
||||
func (comments CommentList) LoadIssues() error {
|
||||
return comments.loadIssues(db.DefaultContext().Engine())
|
||||
return comments.loadIssues(db.GetEngine(db.DefaultContext))
|
||||
}
|
||||
|
Reference in New Issue
Block a user