mirror of
https://github.com/beego/bee.git
synced 2024-11-25 20:10:55 +00:00
help/error message correction and import lib/pq
This commit is contained in:
parent
6d56c04147
commit
9bf23ea88a
2
g.go
2
g.go
@ -23,7 +23,7 @@ var cmdGenerate = &Command{
|
|||||||
bee generate scaffold [scaffoldname] [-fields=""] [-driver=mysql] [-conn="root:@tcp(127.0.0.1:3306)/test"]
|
bee generate scaffold [scaffoldname] [-fields=""] [-driver=mysql] [-conn="root:@tcp(127.0.0.1:3306)/test"]
|
||||||
The generate scaffold command will do a number of things for you.
|
The generate scaffold command will do a number of things for you.
|
||||||
-fields: a list of table fields. Format: field:type, ...
|
-fields: a list of table fields. Format: field:type, ...
|
||||||
-driver: [mysql | postgresql | sqlite], the default is mysql
|
-driver: [mysql | postgres | 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, the default is root:@tcp(127.0.0.1:3306)/test
|
||||||
example: bee generate scaffold post -fields="title:string,body:text"
|
example: bee generate scaffold post -fields="title:string,body:text"
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
_ "github.com/go-sql-driver/mysql"
|
_ "github.com/go-sql-driver/mysql"
|
||||||
|
_ "github.com/lib/pq"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -223,7 +224,7 @@ func generateAppcode(driver, connStr, level, tables, currpath string) {
|
|||||||
func gen(dbms, connStr string, mode byte, selectedTableNames map[string]bool, currpath string) {
|
func gen(dbms, connStr string, mode byte, selectedTableNames map[string]bool, currpath string) {
|
||||||
db, err := sql.Open(dbms, connStr)
|
db, err := sql.Open(dbms, connStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ColorLog("[ERRO] Could not connect to %s: %s\n", dbms, connStr)
|
ColorLog("[ERRO] Could not connect to %s database: %s %s\n", dbms, connStr, err)
|
||||||
os.Exit(2)
|
os.Exit(2)
|
||||||
}
|
}
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
|
Loading…
Reference in New Issue
Block a user