Browse Source

Use variables for times

tags/v1.2.0-rc1
Andrey Nering 7 years ago
parent
commit
a90ffffb1a
1 changed files with 14 additions and 6 deletions
  1. 14
    6
      models/issue_watch.go

+ 14
- 6
models/issue_watch.go View File

@@ -22,16 +22,24 @@ type IssueWatch struct {

// BeforeInsert is invoked from XORM before inserting an object of this type.
func (iw *IssueWatch) BeforeInsert() {
iw.Created = time.Now()
iw.CreatedUnix = time.Now().Unix()
iw.Updated = time.Now()
iw.UpdatedUnix = time.Now().Unix()
var (
t = time.Now()
u = t.Unix()
)
iw.Created = t
iw.CreatedUnix = u
iw.Updated = t
iw.UpdatedUnix = u
}

// BeforeUpdate is invoked from XORM before updating an object of this type.
func (iw *IssueWatch) BeforeUpdate() {
iw.Updated = time.Now()
iw.UpdatedUnix = time.Now().Unix()
var (
t = time.Now()
u = t.Unix()
)
iw.Updated = t
iw.UpdatedUnix = u
}

// CreateOrUpdateIssueWatch set watching for a user and issue

Loading…
Cancel
Save