Skip to content

Instantly share code, notes, and snippets.

@BK1031
Created July 15, 2024 22:31
Show Gist options
  • Save BK1031/8ebe998f1c7b5001e8d38b9d0230af2b to your computer and use it in GitHub Desktop.
Save BK1031/8ebe998f1c7b5001e8d38b9d0230af2b to your computer and use it in GitHub Desktop.
singlestore-go-bookstore updated CreateBook function
package service
import (
"bookstore/database"
"bookstore/model"
)
func CreateBook(book model.Book) (model.Book, error) {
result := database.DB.Create(&book)
if result.Error != nil {
return model.Book{}, result.Error
}
return book, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment