14 lines
280 B
Go
14 lines
280 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
|
||
|
}
|