package models // UpdateAuthor updates an author by its ID and a new author struct 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 }