下载xorm.io/reverse
go get xorm.io/reverse
安装xorm.io/reverse
go install xorm.io/reverse
创建yml文件,文件内容
kind: reverse
name: grc
source:
database: mysql
conn_str: 'root:root@sec123@tcp(ip:端口)/grc?charset=utf8'
targets:
- type: codes
include_tables:
- grc_button_list
- grc_control_list
multiple_files: true
language: golang
output_dir: model #输出的目录
通过yml生成model
reverse -f templates/tpl.yml(templates/tpl.yml为文件路径)