Skip to content

Instantly share code, notes, and snippets.

@mohashari
Created June 23, 2018 16:31
Show Gist options
  • Select an option

  • Save mohashari/36198abdad554790e7344090d1587896 to your computer and use it in GitHub Desktop.

Select an option

Save mohashari/36198abdad554790e7344090d1587896 to your computer and use it in GitHub Desktop.
func fetchSingleStuden(c *gin.Context) {
var model student
var vo transformedStudent
modelID := c.Param("id")
db.Find(&model, modelID)
if model.ID == 0 {
c.JSON(http.StatusNotFound, gin.H{"message": http.StatusNotFound, "result": "Data Tidak Ada"})
}
vo = transferModelToVo(model)
c.JSON(http.StatusOK, gin.H{"message": http.StatusOK, "result": vo})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment