Library/models/authors_add.go

15 lines
257 B
Go
Raw Normal View History

package models
2017-11-07 15:35:10 +00:00
func AddAuthor(author Author) (newAuthor Author, err error) {
_, err = x.Insert(&author)
if err != nil {
return Author{}, err
}
// Get the newly inserted author
newAuthor, _, err = GetAuthorByID(author.ID)
return newAuthor, err
2017-11-07 15:35:10 +00:00
}