Skip to main content

go框架的安装

Beego

下载Beego

go get github.com/astaxie/beego

下载beego脚手架工具bee

go get github.com/beego/bee

下载Beego的ORM

go get github.com/astaxie/orm

Mysql数据库 https://github.com/go-sql-driver/mysql

go get -u github.com/go-sql-driver/mysql

数据库连接

连接的样式

格式
[username[:password]@][protocol[(address)]]/dbname[?param1=value1&...&paramN=valueN]
例如
username:password@protocol(address)/dbname?param=value

配合ORM就是

orm.RegisterDataBase("default","mysql","root:root@tcp(127.0.0.1:3306)/test")
//orm.RegisterModel(new(Page))

查看