mirror of
https://github.com/casbin/bee.git
synced 2025-07-17 21:54:20 +08:00
This fixes #201
This commit is contained in:
10
g_appcode.go
10
g_appcode.go
@ -292,7 +292,7 @@ func generateAppcode(driver, connStr, level, tables, currpath string) {
|
||||
|
||||
// Generate takes table, column and foreign key information from database connection
|
||||
// and generate corresponding golang source files
|
||||
func gen(dbms, connStr string, mode byte, selectedTableNames map[string]bool, currpath string) {
|
||||
func gen(dbms, connStr string, mode byte, selectedTableNames map[string]bool, apppath string) {
|
||||
db, err := sql.Open(dbms, connStr)
|
||||
if err != nil {
|
||||
ColorLog("[ERRO] Could not connect to %s database: %s, %s\n", dbms, connStr, err)
|
||||
@ -304,11 +304,11 @@ func gen(dbms, connStr string, mode byte, selectedTableNames map[string]bool, cu
|
||||
tableNames := trans.GetTableNames(db)
|
||||
tables := getTableObjects(tableNames, db, trans)
|
||||
mvcPath := new(MvcPath)
|
||||
mvcPath.ModelPath = path.Join(currpath, "models")
|
||||
mvcPath.ControllerPath = path.Join(currpath, "controllers")
|
||||
mvcPath.RouterPath = path.Join(currpath, "routers")
|
||||
mvcPath.ModelPath = path.Join(apppath, "models")
|
||||
mvcPath.ControllerPath = path.Join(apppath, "controllers")
|
||||
mvcPath.RouterPath = path.Join(apppath, "routers")
|
||||
createPaths(mode, mvcPath)
|
||||
pkgPath := getPackagePath(currpath)
|
||||
pkgPath := getPackagePath(apppath)
|
||||
writeSourceFiles(pkgPath, tables, mode, mvcPath, selectedTableNames)
|
||||
} else {
|
||||
ColorLog("[ERRO] Generating app code from %s database is not supported yet.\n", dbms)
|
||||
|
Reference in New Issue
Block a user