Created
June 21, 2018 17:05
-
-
Save mohashari/72ccb2f3e27712c0ec26b72d10b3e46b to your computer and use it in GitHub Desktop.
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
| func fetchAllStudent(c *gin.Context) { | |
| var model [] student | |
| var vo [] transformedStudent | |
| db.Find(&model) | |
| if len(model) <= 0 { | |
| c.JSON(http.StatusNotFound, gin.H{"message": http.StatusNotFound, "result": "Data Tidak Ada"}) | |
| } | |
| for _, item := range model { | |
| vo = append(vo, transferModelToVo(item)) | |
| } | |
| 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