Library/models/authors_update.go

15 lines
282 B
Go

package models
func UpdateAuthor(author Author, id int64) (newAuthor Author, err error) {
_, 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
}