by SystemGlitch · 6y ago · 0 comments
func Show(response *goyave.Response, request *goyave.Request) {
product := model.Product{}
id, _ := strconv.ParseUint(request.Params["id"], 10, 64)
result := database.GetConnection().First(&product, id)
if response.HandleDatabaseError(result) {
response.JSON(http.StatusOK, product)
}
}
"response.HandleDatabaseError" is the helper we're talking about.No comments yet.