代码拉取完成,页面将自动刷新
package main
import (
"flag"
"fmt"
"github.com/go-libraries/gmodel/generator"
"os"
)
var (
modelPath string
driver string
dsn string
ignoreTable string
style string
packageName string
help bool
h bool
)
func init() {
currentPath, _ := os.Getwd()
flag.StringVar(&modelPath, "dir", currentPath, "a dir name save model file path, default is current path")
flag.StringVar(&driver, "driver", "mysql", "database driver,like `mysql` `mariadb`, default is mysql")
flag.StringVar(&dsn, "dsn", "", "connection info names dsn")
flag.StringVar(&ignoreTable, "ig_tables", "", "ignore table names")
flag.StringVar(&style, "style", "default", "use orm style like `bee` `gorm`, default `default`")
flag.StringVar(&packageName, "package", "", "help")
flag.BoolVar(&help, "help", false, "this help")
flag.BoolVar(&h, "h", false, "this help")
}
func main() {
flag.Parse()
if h {
flag.Usage()
}
if dsn == "" {
flag.Usage()
}
flag.Usage = usage
generator.GetDriver(modelPath, driver, dsn, style, packageName).Run()
}
func usage() {
fmt.Println("Usage: model [-dir dirname] [-driver mysql] [-dsn username:password@tcp(host:port)/database]")
flag.PrintDefaults()
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。