Skip to content

Commit 9563548

Browse files
lunnylafriks
authored andcommitted
simple usage of x (#3144)
1 parent 03ec35e commit 9563548

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

models/attachment.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,8 @@ type Attachment struct {
3131

3232
// IncreaseDownloadCount is update download count + 1
3333
func (a *Attachment) IncreaseDownloadCount() error {
34-
sess := x.NewSession()
35-
defer sess.Close()
36-
3734
// Update download count.
38-
if _, err := sess.Exec("UPDATE `attachment` SET download_count=download_count+1 WHERE id=?", a.ID); err != nil {
35+
if _, err := x.Exec("UPDATE `attachment` SET download_count=download_count+1 WHERE id=?", a.ID); err != nil {
3936
return fmt.Errorf("increase attachment count: %v", err)
4037
}
4138

0 commit comments

Comments
 (0)