how do I convert it?
//
func GetPlan(c *gin.Context){
//expect := c.PostForm("expect")
prevexpect,_ := strconv.Atoi(PrevExpect())
sql := "SELECT * from plan pl " +
"left JOIN program pr on pl.program_id = pr.id " +
"left JOIN program_info pi on pi.program_id = pr.id and pi.code = pr.code " +
"where pr.status = 1 and pi.status = 1 and pl.expect = ?"
res,err := models.Engine.Query(sql,prevexpect+1)
r := make(gin.H)
if err == nil {
m := make([]map[string]string,len(res))
for k,v := range res {
m[k] = make(map[string]string)
for kk,vv := range v{
m[k][kk] = string(vv)
}
}
r["Code"] = 0
r["Message"] = ""
r["Data"] = m
c.XML(200,r)
//c.JSON(200,r)
} else {
r["Code"] = 1
r["Message"] = ""
r["Data"] = err
c.XML(200,gin.H{
"data":"",
})
}
}
the error is as follows
xml: unsupported type: map[string]string
/usr/local/go/src/runtime/panic.go:491 (0x102b982)
gopanic: reflectcall(nil, unsafe.Pointer(d.fn), deferArgs(d), uint32(d.siz), uint32(d.siz))
/Users/dev/go/src/github.com/gin-gonic/gin/context.go:646 (0x14f35df)
(*Context).Render: panic(err)
/Users/dev/go/src/github.com/gin-gonic/gin/context.go:682 (0x14f38cb)
(*Context).XML: c.Render(code, render.XML{Data: obj})
/Users/dev/go/src/autoBetServer/controller/plan.go:273 (0x166170b)
GetPlan: c.XML(200,r)
/Users/dev/go/src/github.com/gin-gonic/gin/context.go:107 (0x14f0a82)
(*Context).Next: c.handlers[c.index](c)
/Users/dev/go/src/github.com/gin-contrib/sessions/sessions.go:65 (0x161759f)
Sessions.func1: c.Next()
/Users/dev/go/src/github.com/gin-gonic/gin/context.go:107 (0x14f0a82)
(*Context).Next: c.handlers[c.index](c)
/Users/dev/go/src/github.com/gin-gonic/gin/recovery.go:46 (0x1502d29)
RecoveryWithWriter.func1: c.Next()
/Users/dev/go/src/github.com/gin-gonic/gin/context.go:107 (0x14f0a82)
(*Context).Next: c.handlers[c.index](c)
/Users/dev/go/src/github.com/gin-gonic/gin/logger.go:83 (0x150205b)
LoggerWithWriter.func1: c.Next()
/Users/dev/go/src/github.com/gin-gonic/gin/context.go:107 (0x14f0a82)
(*Context).Next: c.handlers[c.index](c)
/Users/dev/go/src/github.com/gin-gonic/gin/gin.go:359 (0x14f9b95)
(*Engine).handleHTTPRequest: c.Next()
/Users/dev/go/src/github.com/gin-gonic/gin/gin.go:326 (0x14f932a)
(*Engine).ServeHTTP: engine.handleHTTPRequest(c)
/usr/local/go/src/net/http/server.go:2619 (0x126f2c3)
serverHandler.ServeHTTP: handler.ServeHTTP(rw, req)
/usr/local/go/src/net/http/server.go:1801 (0x126b40c)
(*conn).serve: serverHandler{c.server}.ServeHTTP(w, w.req)
/usr/local/go/src/runtime/asm_amd64.s:2337 (0x10593c0)
goexit: BYTE $0x90 // NOP