diff options
author | Thibault Meyer <meyer.thibault@gmail.com> | 2016-11-10 16:16:32 +0100 |
---|---|---|
committer | Thibault Meyer <meyer.thibault@gmail.com> | 2016-11-10 20:59:51 +0100 |
commit | a4454f5d0fbeaacb94668012acbb4296465cb28f (patch) | |
tree | eaf39d1935eda44cf16df08234d2bbddd39c3ddd /models/user_mail.go | |
parent | c040f2fbb13ef5ba2c6a619322d4801e9f78c885 (diff) | |
download | gitea-a4454f5d0fbeaacb94668012acbb4296465cb28f.tar.gz gitea-a4454f5d0fbeaacb94668012acbb4296465cb28f.zip |
Rewrite XORM queries
Diffstat (limited to 'models/user_mail.go')
-rw-r--r-- | models/user_mail.go | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/models/user_mail.go b/models/user_mail.go index 9a1804c91a..9dc3d624b4 100644 --- a/models/user_mail.go +++ b/models/user_mail.go @@ -22,7 +22,9 @@ type EmailAddress struct { // GetEmailAddresses returns all email addresses belongs to given user. func GetEmailAddresses(uid int64) ([]*EmailAddress, error) { emails := make([]*EmailAddress, 0, 5) - if err := x.Where("uid=?", uid).Find(&emails); err != nil { + if err := x. + Where("uid=?", uid). + Find(&emails); err != nil { return nil, err } @@ -120,7 +122,10 @@ func (email *EmailAddress) Activate() error { } email.IsActivated = true - if _, err := sess.Id(email.ID).AllCols().Update(email); err != nil { + if _, err := sess. + Id(email.ID). + AllCols(). + Update(email); err != nil { return err } else if err = updateUser(sess, user); err != nil { return err @@ -133,7 +138,9 @@ func DeleteEmailAddress(email *EmailAddress) (err error) { if email.ID > 0 { _, err = x.Id(email.ID).Delete(new(EmailAddress)) } else { - _, err = x.Where("email=?", email.Email).Delete(new(EmailAddress)) + _, err = x. + Where("email=?", email.Email). + Delete(new(EmailAddress)) } return err } |