goLang
microcosm1994
这个作者很懒,什么都没留下…
展开
-
使用vue+golang+mysql写一个即时聊天、多人视频的项目
项目为学习golang的一个新手项目,功能包括短信登陆、注册、添加好友、修改备注、创建群组、加入群组、好友即时聊天、视频聊天、群组聊天、多人视频等功能前端:vue、element-ui、vue-socket、webrtc后端:beego、mysql、socket.io、swagger服务器:nginx、STUN/TURN穿透前端项目地址:https://github.com/microcosm1994/chatApp-vue后端项目地址:https://github.com/microcosm19原创 2020-06-12 14:42:38 · 2311 阅读 · 7 评论 -
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 · 3347 阅读 · 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 · 940 阅读 · 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 · 1907 阅读 · 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 · 1148 阅读 · 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 · 1510 阅读 · 2 评论 -
golang注册数据库提示“注册db'default',网络'localhost:3306'的默认地址未知 必须有一个名为'default'的注册数据库别名`”
register db `default`, default addr for network 'localhost:3306' unknownmust have one register DataBase alias named `default`代码:orm.RegisterDataBase("default", "mysql", "root:113655@localhost:330...原创 2020-01-15 17:50:05 · 2884 阅读 · 0 评论 -
beego返回json数据
package controllersimport ( "github.com/astaxie/beego")type UserController struct { beego.Controller}// 定义返回的结构体,并转为json格式type Result struct { Status int `json:"status"` // 首字母大写 Msg stri...原创 2019-11-15 15:17:31 · 1547 阅读 · 0 评论 -
go结构体转json
type Result struct { Status int `json:"status"` // 首字母大写 Msg string `json:"msg"`}原创 2019-11-15 15:15:52 · 300 阅读 · 1 评论 -
beego命名路由
router.gopackage routersimport ( "chatAppServer/controllers" "github.com/astaxie/beego")func init() { ns := beego.NewNamespace("/user", beego.NSRouter("/getMessageCode", &controller...原创 2019-11-15 15:12:15 · 281 阅读 · 0 评论