Feature model postgresql (#842)

* Support postgresql generate

* Update template Var

* Support to generate postgresql model

* Support to generate postgresql model

* Update template

Co-authored-by: anqiansong <anqiansong@xiaoheiban.cn>
This commit is contained in:
anqiansong
2021-07-23 11:45:15 +08:00
committed by GitHub
parent 476026e393
commit 089cdaa75f
19 changed files with 484 additions and 59 deletions

View File

@@ -455,7 +455,48 @@ var (
Usage: "for idea plugin [optional]",
},
},
Action: model.MyDataSource,
Action: model.MySqlDataSource,
},
},
},
{
Name: "postgresql",
Usage: `generate postgresql model`,
Subcommands: []cli.Command{
{
Name: "datasource",
Usage: `generate model from datasource`,
Flags: []cli.Flag{
cli.StringFlag{
Name: "url",
Usage: `the data source of database,like "root:password@tcp(127.0.0.1:3306)/database`,
},
cli.StringFlag{
Name: "table, t",
Usage: `the table or table globbing patterns in the database`,
},
cli.StringFlag{
Name: "schema, s",
Usage: `the table schema, default is [public]`,
},
cli.BoolFlag{
Name: "cache, c",
Usage: "generate code with cache [optional]",
},
cli.StringFlag{
Name: "dir, d",
Usage: "the target dir",
},
cli.StringFlag{
Name: "style",
Usage: "the file naming format, see [https://github.com/tal-tech/go-zero/tree/master/tools/goctl/config/readme.md]",
},
cli.BoolFlag{
Name: "idea",
Usage: "for idea plugin [optional]",
},
},
Action: model.PostgreSqlDataSource,
},
},
},