Rewrite XORM queries

This commit is contained in:
Thibault Meyer 2016-11-10 16:16:32 +01:00
parent c040f2fbb1
commit a4454f5d0f
No known key found for this signature in database
GPG key ID: BE39A108C4DDA755
22 changed files with 480 additions and 233 deletions

View file

@ -131,7 +131,10 @@ func (repo *Repository) ChangeCollaborationAccessMode(uid int64, mode AccessMode
return err
}
if _, err = sess.Id(collaboration.ID).AllCols().Update(collaboration); err != nil {
if _, err = sess.
Id(collaboration.ID).
AllCols().
Update(collaboration); err != nil {
return fmt.Errorf("update collaboration: %v", err)
} else if _, err = sess.Exec("UPDATE access SET mode = ? WHERE user_id = ? AND repo_id = ?", mode, uid, repo.ID); err != nil {
return fmt.Errorf("update access table: %v", err)