Skip to content

Instantly share code, notes, and snippets.

@mohashari
Created June 21, 2018 16:00
Show Gist options
  • Select an option

  • Save mohashari/252d8602f79ebcd6a22d84cd7b4ae0c0 to your computer and use it in GitHub Desktop.

Select an option

Save mohashari/252d8602f79ebcd6a22d84cd7b4ae0c0 to your computer and use it in GitHub Desktop.
func cretedStudent(c *gin.Context) {
var std transformedStudent
var model student
c.Bind(&std)
validasi := validatorCreated(std)
model = transferVoToModel(std)
if validasi != "" {
c.JSON(http.StatusOK, gin.H{"message": http.StatusOK, "result": validasi})
} else {
db.Create(&model)
c.JSON(http.StatusOK, gin.H{"message": http.StatusOK, "result": model})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment