eg.GET("https://discussion board.golangbridge.org/", func(c *gin.Context) {
question := "SELECT id, r_id, p_id, s_id from entire ORDER BY id DESC restrict 6"
r, err := db.Question(question)
if err != nil {
log.Fatalln("DB Connetion ERROR occured :", err)
}
information := []PRS_id{}
for r.Subsequent() {
var temp PRS_id
r.Scan(&temp.ID, &temp.RID, &temp.PID, &temp.SID)
information = append(information, temp)
}
fmt.Println(information)
c.HTML(http.StatusOK, "index.html", information)
})
I’m making my very own weblog and there are three class : tasks, assessment, examine
I made every class’s desk in my DB, and likewise made ‘entire’ DB which has international key with every classes to make viewing ‘current 6 posts’
the variety of posts are 9
In my thought, the ‘information’ construction has to print
{9,3,0,0}{8,0,3,0}{7,3,0,0}{6,0,0,3}{5,0,0,3}{4,0,3,0}
nevertheless it really prints
{9,3,0,0}{8,0,0,0}{7,3,0,0}{6,0,0,0}{5,0,0,0}{4,0,0,0}
the id and PID printed nicely, however Idk why RID and SID didn’t print nicely
and after I write that question in DB at console, it really works nicely.
anybody is aware of about this downside?