We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 03ec35e commit 9563548Copy full SHA for 9563548
models/attachment.go
@@ -31,11 +31,8 @@ type Attachment struct {
31
32
// IncreaseDownloadCount is update download count + 1
33
func (a *Attachment) IncreaseDownloadCount() error {
34
- sess := x.NewSession()
35
- defer sess.Close()
36
-
37
// Update download count.
38
- if _, err := sess.Exec("UPDATE `attachment` SET download_count=download_count+1 WHERE id=?", a.ID); err != nil {
+ if _, err := x.Exec("UPDATE `attachment` SET download_count=download_count+1 WHERE id=?", a.ID); err != nil {
39
return fmt.Errorf("increase attachment count: %v", err)
40
}
41
0 commit comments