|
package models
|
|
|
|
// AddAuthor adds a new author based on an author struct
|
|
func AddAuthor(author Author) (newAuthor Author, err error) {
|
|
_, err = x.Insert(&author)
|
|
|
|
if err != nil {
|
|
return Author{}, err
|
|
}
|
|
|
|
// Get the newly inserted author
|
|
newAuthor = author
|
|
|
|
return newAuthor, err
|
|
}
|