网站关于beego的参考资料,说多也多,说少也少。从 python转go,业务逻辑其实都不是什么问题,目前最让人感到烦躁的就是数据类型的转换,map、strcut数据的增加,strcut里套strcut的数据增加。还有就是数据返回的问题
简单的需求,用python写的话,很简单,用go的话。。。。应该有好办法,我的办法太笨了
{ "Errorcode": 0,
"Handle": {"FunctionInfo": "Get"},
"Message": "ok",
"Data": {
"Regular": {"project_name": "学生名/项目名"},
"Dynamic": {"stu_count": "人数", "stucount": "人数或个数"}
}
}
var returndata map[string]interface{}
var Dynamic map[string]interface{}
var Handle map[string]string
var Regular map[string]string
var Data map[string]interface{}
func (this*WorkloadContraller)GetAllFunctionByDepartment() {
returndata["Errorcode"]="0"
Handle["FunctionInfo"]="Get"
returndata["Message"]="ok"
Regular["Project_name"]="学生名/项目名"
Dynamic["stu_count"]= "人数"
Dynamic["stucount""] ="人数或个数"
reurndata["Handle"]=Handle
Data["Regular"]=Regular
Data["Dynamic"]=Dynamic
returndata["Data"]=Data
this.Data["json"] = returndata
this.ServeJSON()
}