mirror of
https://github.com/beego/bee.git
synced 2024-11-22 05:00:54 +00:00
add default value for postgres conn
This commit is contained in:
parent
b9ff4255ff
commit
4b56b8576c
8
g.go
8
g.go
@ -51,7 +51,9 @@ bee generate appcode [-tables=""] [-driver=mysql] [-conn="root:@tcp(127.0.0.1:33
|
||||
generate appcode based on an existing database
|
||||
-tables: a list of table names separated by ',', default is empty, indicating all tables
|
||||
-driver: [mysql | postgresql | sqlite], the default is mysql
|
||||
-conn: the connection string used by the driver, the default is root:@tcp(127.0.0.1:3306)/test
|
||||
-conn: the connection string used by the driver.
|
||||
default for mysql: root:@tcp(127.0.0.1:3306)/test
|
||||
default for postgres: postgres://postgres:postgres@127.0.0.1:5432/postgres
|
||||
-level: [1 | 2 | 3], 1 = models; 2 = models,controllers; 3 = models,controllers,router
|
||||
`,
|
||||
}
|
||||
@ -137,7 +139,11 @@ func generateCode(cmd *Command, args []string) int {
|
||||
if conn == "" {
|
||||
conn = docValue(conf.Database.Conn)
|
||||
if conn == "" {
|
||||
if driver == "mysql" {
|
||||
conn = "root:@tcp(127.0.0.1:3306)/test"
|
||||
} else if driver == "postgres" {
|
||||
conn = "postgres://postgres:postgres@127.0.0.1:5432/postgres"
|
||||
}
|
||||
}
|
||||
}
|
||||
if level == "" {
|
||||
|
Loading…
Reference in New Issue
Block a user