Created
July 15, 2024 23:06
-
-
Save BK1031/e5df2fc49345bd5b1bb290423e11fcaf to your computer and use it in GitHub Desktop.
singlestore-go-bookstore book skeleton functions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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