![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
beego
microcosm1994
这个作者很懒,什么都没留下…
展开
-
beego关联操作
原文地址beego关联操作一对多关联插入操作:只需要在文章表插入类型对象即可。代码如下: o := orm.NewOrm() article := models.Article{} artiType := models.ArticleType{Id:id} o.Read(&artiType) article.ArticleType = &artiType o...转载 2020-02-05 12:52:27 · 1124 阅读 · 0 评论 -
beego关联操作
一对多(反向多对一)结构体:/*SysGroup 群组 */type SysGroup struct { Id int `json:"id" required:"false" description:"群id"` GroupMpId int `json:"groupMpId" required:"false" description:"群主id"`...原创 2020-02-05 12:47:51 · 428 阅读 · 0 评论 -
golang XXX undefined (type interface {} is interface with no methods)
解决 XXX undefined (type interface {} is interface with no methods)type User struct { Name string Age int }var data User{ Name: "zs", Age: 18,}// 保存sessionSetSession("user", data)// 取出sessio...原创 2020-01-26 01:47:33 · 3406 阅读 · 0 评论 -
beego中使用mysql高级查询与构造查询
先保证已经链接到数据库注册定义modelmodels/user.gopackage modelsimport ( "fmt" "github.com/astaxie/beego/orm")type SysUser struct { Id int `json:"id"` NickName string `json:"nickName"` Phone...原创 2020-01-16 19:30:58 · 958 阅读 · 0 评论 -
beego与mysql建立连接
安装go get github.com/astaxie/beego/ormgo get github.com/Go-SQL-Driver/MySQL引入main.goimport ( _ "chatAppServer/routers" "github.com/astaxie/beego" "github.com/astaxie/beego/orm" // <- _ "gi...原创 2020-01-16 17:47:14 · 1942 阅读 · 0 评论 -
beego注解路由
注解路由router.gopackage routersimport ( "chatAppServer/controllers" "github.com/astaxie/beego")func init() { ns := beego.NewNamespace("/user", beego.NSInclude( &controllers.UserCon...原创 2020-01-16 17:29:04 · 1181 阅读 · 0 评论 -
beego api自动生成文档
必须设置在 routers/router.go 中,文件的注释,最顶部:// @APIVersion 1.0.0// @Title mobile API// @Description mobile has every tool to get any job done, so codename for the new mobile APIs.// @Contact astaxie@gmail...原创 2020-01-16 17:21:18 · 1533 阅读 · 2 评论