These are chat archives for gin-gonic/gin

12th
Jun 2015
gopher-philippines
@ambo1994
Jun 12 2015 04:28
This message was deleted
gopher-philippines
@ambo1994
Jun 12 2015 05:23
It return me to an error: "no user(s) into the table". Anything wrong on my code? Need help :)
type DeviceInfo struct {
    Id        int64       `json:"id"`
    User      int64       `json:"user"`
    }
func DeviceList(c *gin.Context) {

    var device []DeviceInfo
    _, err := dbmap.Select(&device, "SELECT userdevice.id, user.name As user  FROM userdevice inner join user On userdevice.user_id = user.id")

    if err == nil {

        c.JSON(200, MessageInfoDevice{
            Status:  "#200 Ok",
            Message: "Data Found",
            Data:    device,
        })

    } else {
        c.JSON(404, gin.H{"error": "no user(s) into the table"})
    }

}
Nick K
@utrack
Jun 12 2015 07:17
@ambo1994 it's not really a question about Gin
@ambo1994 but if you returned err.Error() instead your string it could help ya
Roman Zaynetdinov
@zaynetro
Jun 12 2015 07:59
Hi! Has anyone worked with go-bindata and gin? I need to bind my static files and templates as well. Any sources?
Roman Zaynetdinov
@zaynetro
Jun 12 2015 08:09
I found how to serve static files based on this example. So now I am struggling with loading templates.
Joonathan M├Ągi
@joonathan
Jun 12 2015 08:24
@radutopala this seems to be an option as well https://github.com/rainbowism/gin-pongo2
DenisNeustroev
@DenisNeustroev
Jun 12 2015 19:08
Hi all, I have a very strange bug with templates: cURL output have <pre></pre> tag before <!DOCTYPE html> but it doesn't exist in the html code