最新回答 / zhangjingqiang
model 层看这两个文件就够了:https://github.com/go-learn-go/guess/blob/master/test.sqlhttps://github.com/go-learn-go/guess/blob/master/models/subject.go
2019-01-23
已采纳回答 / 番茄土豆黄瓜
orm.RegisterDataBase("default", "mysql", "root:123456@tcp(127.0.0.1:3306)/DB_NAME?charset=utf8")
2018-12-29
PS C:\go\src> bee new blog
______
| ___ \
| |_/ / ___ ___
| ___ \ / _ \ / _ \
| |_/ /| __/| __/
\____/ \___| \___| v1.10.0
______
| ___ \
| |_/ / ___ ___
| ___ \ / _ \ / _ \
| |_/ /| __/| __/
\____/ \___| \___| v1.10.0
2018-12-25
PS C:\docker\go\beego> go get -u github.com/astaxie/beego
PS C:\docker\go\beego> go get -u github.com/beego/bee
PS C:\docker\go\beego> bee version
PS C:\docker\go\beego> go get -u github.com/beego/bee
PS C:\docker\go\beego> bee version
2018-12-25
最新回答 / 番茄土豆黄瓜
原因:使用ORM创建表 我们定义结构体作为表,必须要有主键解决:在init方法中添加orm.RunSyncdb("default", false, true) // true 改成false,如果表存在则会给出提示,如果改成false则不会提示 , 这句话没有会报主键不存在的错误
2018-12-03
最新回答 / Antony_0001
orm.RegisterDataBase("default", "mysql", "root:password@/database?charset=utf8")
2018-11-24