Skip to content

Instantly share code, notes, and snippets.

@BK1031
Created July 15, 2024 23:06
Show Gist options
  • Save BK1031/e5df2fc49345bd5b1bb290423e11fcaf to your computer and use it in GitHub Desktop.
Save BK1031/e5df2fc49345bd5b1bb290423e11fcaf to your computer and use it in GitHub Desktop.
singlestore-go-bookstore book skeleton functions
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
}
func UpdateBook(book model.Book) (model.Book, error) {
return book, nil
}
func DeleteBook(book model.Book) error {
return nil
}
func GetBook(id uint) (model.Book, error) {
return model.Book{}, nil
}
func GetAllBooks() []model.Book {
return []model.Book{}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment