2017-10-11 18:22:31 +00:00
|
|
|
package models
|
|
|
|
|
2017-11-07 15:35:10 +00:00
|
|
|
func UpdateAuthor(author Author, id int64) (newAuthor Author, err error) {
|
2017-10-11 18:22:31 +00:00
|
|
|
_, err = x.Where("id = ?", id).Update(&author)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
return Author{}, err
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get the newly updated author
|
|
|
|
newAuthor, _, err = GetAuthorByID(id)
|
|
|
|
|
|
|
|
return newAuthor, err
|
2017-11-07 15:35:10 +00:00
|
|
|
}
|