Library/models/publishers_update.go

16 lines
419 B
Go

package models
// UpdatePublisher updates a publisher, takes an ID and a publisher struct with the new publisher infos
func UpdatePublisher(publisher Publisher, id int64) (newPublisher Publisher, err error) {
_, err = x.Where("id = ?", id).Update(&publisher)
if err != nil {
return Publisher{}, err
}
// Get the newly updated publisher
newPublisher, _, err = GetPublisherByID(id)
return newPublisher, err
}