您可以通过如下的方式安装 bee 工具:
go get github.com/dejavuzhou/ginbo
安装完之后,ginbo
可执行文件默认存放在 $GOPATH/bin
里面,所以您需要把 $GOPATH/bin
添加到您的环境变量中,才可以进行下一步。
如何添加环境变量,请自行搜索
如果你本机设置了GOBIN
,那么上面的命令就会安装到 GOBIN
下,请添加GOBIN
到你的环境变量中
ginbo gen -u root -p PASSWORD -a "127.0.0.1:3306" -d dbname -o "github.com/mojocn/apiapp"
http://127.0.0.1:5555/swagger
C:\Users\zhouqing1\go\src\github.com\mojocn\apiapp>tree /f /a
Folder PATH listing
Volume serial number is 8452-D575
C:.
| 2018-11-15-app.log
| config.toml
| main.go
| readme.md
|
+---config
| viper.go
|
+---handlers
| gin.go
| handler_wp_litespeed_img_optm.go
| handler_wp_litespeed_optimizer.go
| handler_wp_posts.go
| handler_wp_users.go
| handler_wp_yoast_seo_links.go
|
+---models
| db.go
| model_wp_litespeed_img_optm.go
| model_wp_litespeed_optimizer.go
| model_wp_posts.go
| model_wp_users.go
| model_wp_yoast_seo_links.go
|
+---static
| | .gitignore
| | index.html
| | readme.md
| |
| \---index_files
| jquery.js.download
| style.css
| syntax.css
|
\---swagger
.gitignore
doc.yml
favicon-16x16.png
favicon-32x32.png
index.html
oauth2-redirect.html
readme.md
swagger-ui-bundle.js
swagger-ui-standalone-preset.js
swagger-ui.css
swagger-ui.js
ginbo gen -h
generate a RESTful APIs app with gin and gorm for gophers. For example:
ginbo gen -u eric -p password -a "127.0.0.1:3306" -d "mydb"
Usage:
create gen [flags]
Flags:
-a, --address string mysql host:port (default "dev.mojotv.com:3306")
-l, --appAddr string app listen Address eg:mojotv.cn, use domain will support gin-TLS (default "127.0.0.1:5555")
-c, --charset string database charset (default "utf8")
-d, --database string database name (default "dbname")
-h, --help help for gen
-o, --out string golang project package name of your output project. eg: github.com/awesome/my_project, the project will be created at $GOPATH/src/github.com/awesome/my_project (default "github.
com/dejavuzhou/gin-project")
-p, --password string database password (default "Password")
-u, --user string database user name (default "root")
go get -u github.com/gin-contrib/cors
go get -u github.com/gin-contrib/static
go get -u github.com/gin-gonic/autotls
go get -u github.com/gin-gonic/gin
go get -u github.com/sirupsen/logrus
go get -u github.com/spf13/viper
go get -u github.com/spf13/cobra
go get -u github.com/go-redis/redis
go get -u github.com/go-sql-driver/mysql
go get -u github.com/jinzhu/gorm
issue
同时附上数据库表结构文件 1
wenzhoou 2018-11-15 20:48:47 +08:00 via Android
觉得还是要顶一下回家慢慢看。
|
2
bonfy 2018-11-16 09:15:40 +08:00
不考虑测试么?
|
3
qloog 2018-11-16 11:07:18 +08:00
看起来很强大的样子 :)
|