Skip to content

Commit

Permalink
feat(db): add db param
Browse files Browse the repository at this point in the history
  • Loading branch information
cg33 committed Aug 23, 2022
1 parent 5770218 commit 2c751a9
Show file tree
Hide file tree
Showing 26 changed files with 210 additions and 448 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ func main() {
User: "root",
Pwd: "root",
Name: "goadmin",
MaxIdleCon: 50,
MaxOpenCon: 150,
ConMaxLifetime: time.Hour,
MaxIdleConns: 50,
MaxOpenConns: 150,
ConnMaxLifetime: time.Hour,
Driver: "mysql",
},
},
Expand Down
6 changes: 3 additions & 3 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ func main() {
User: "root",
Pwd: "root",
Name: "goadmin",
MaxIdleCon: 50,
MaxOpenCon: 150,
ConMaxLifetime: time.Hour,
MaxIdleConns: 50,
MaxOpenConns: 150,
ConnMaxLifetime: time.Hour,
Driver: "mysql",
},
},
Expand Down
246 changes: 0 additions & 246 deletions adapter/gofasthttp/fasthttp.go

This file was deleted.

22 changes: 11 additions & 11 deletions adm/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,17 @@ func askForDBConfig(info *dbInfo) config.DatabaseList {

return map[string]config.Database{
"default": {
Host: info.Host,
Port: info.Port,
User: info.User,
Pwd: info.Password,
Name: info.Database,
MaxIdleCon: 5,
MaxOpenCon: 10,
ConMaxLifetime: time.Hour,
ConMaxIdleTime: 0,
Driver: info.DriverName,
File: "",
Host: info.Host,
Port: info.Port,
User: info.User,
Pwd: info.Password,
Name: info.Database,
MaxIdleConns: 5,
MaxOpenConns: 10,
ConnMaxLifetime: time.Hour,
ConnMaxIdleTime: 0,
Driver: info.DriverName,
File: "",
},
}
} else {
Expand Down
20 changes: 10 additions & 10 deletions adm/project_web.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,16 @@ func buildProjectWeb(port string) {
if info.DriverName != db.DriverSqlite {
dbList = map[string]config.Database{
"default": {
Host: info.Host,
Port: info.Port,
User: info.User,
Pwd: info.Password,
Name: info.Database,
MaxIdleCon: 5,
MaxOpenCon: 10,
ConMaxLifetime: time.Hour,
ConMaxIdleTime: 0,
Driver: info.DriverName,
Host: info.Host,
Port: info.Port,
User: info.User,
Pwd: info.Password,
Name: info.Database,
MaxIdleConns: 5,
MaxOpenConns: 10,
ConnMaxLifetime: time.Hour,
ConnMaxIdleTime: 0,
Driver: info.DriverName,
},
}
} else {
Expand Down
18 changes: 9 additions & 9 deletions examples/beego/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ func main() {
Env: config.EnvLocal,
Databases: config.DatabaseList{
"default": {
Host: "127.0.0.1",
Port: "3306",
User: "root",
Pwd: "root",
Name: "godmin",
MaxIdleCon: 50,
MaxOpenCon: 150,
ConMaxLifetime: time.Hour,
Driver: config.DriverMysql,
Host: "127.0.0.1",
Port: "3306",
User: "root",
Pwd: "root",
Name: "godmin",
MaxIdleConns: 50,
MaxOpenConns: 150,
ConnMaxLifetime: time.Hour,
Driver: config.DriverMysql,
},
},
Store: config.Store{
Expand Down
25 changes: 14 additions & 11 deletions examples/beego2/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package main

import (
"log"
"os"
"os/signal"
"time"

_ "github.com/GoAdminGroup/go-admin/adapter/beego2"
_ "github.com/GoAdminGroup/go-admin/modules/db/drivers/mysql"

Expand All @@ -13,9 +18,6 @@ import (
"github.com/GoAdminGroup/go-admin/template/chartjs"
"github.com/GoAdminGroup/themes/adminlte"
"github.com/beego/beego/v2/server/web"
"log"
"os"
"os/signal"
)

func main() {
Expand All @@ -27,14 +29,15 @@ func main() {
Env: config.EnvLocal,
Databases: config.DatabaseList{
"default": {
Host: "127.0.0.1",
Port: "3306",
User: "root",
Pwd: "123456",
Name: "godmin",
MaxIdleCon: 50,
MaxOpenCon: 150,
Driver: config.DriverMysql,
Host: "127.0.0.1",
Port: "3306",
User: "root",
Pwd: "123456",
Name: "godmin",
MaxIdleConns: 50,
MaxOpenConns: 150,
ConnMaxLifetime: time.Hour,
Driver: config.DriverMysql,
},
},
Store: config.Store{
Expand Down
Loading

0 comments on commit 2c751a9

Please sign in to comment.