package controllers import ( "go_blog/models" "net/http" "strconv" "github.com/gin-gonic/gin" ) func ShowPost(c *gin.Context) { id, err := strconv.ParseInt(c.Param("id"), 10, 32) if err != nil { return } var content = models.Content{Cid: int32(id)} models.DB.First(&content) c.HTML(http.StatusOK, "post.tmpl", content) }