This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
#!/bin/bash
# 使用方法:
# ./genModel.sh
# 再将./genModel下的文件剪切到对应服务的model目录里面,记得改package
#待生成的表名
tables=("user" "user_login_record" "role" "rel_user_role")
#生成路径
targetDir=./genModel
templateDir=../../doc/template
# 数据库配置
host=192.168.1.100
port=3306
dbname=qxb
username=root
passwd=root
for table in "${tables[@]}"; do
echo "开始创建库:$dbname 的表:${table}"
goctl model mysql datasource --url "${username}:${passwd}@tcp(${host}:${port})/${dbname}" -t "${table}" -d "${targetDir}" --style go_zero --home "${templateDir}"
done