|
@@ -15,8 +15,6 @@ import (
|
|
|
"github.com/go-xorm/xorm"
|
|
|
"log"
|
|
|
|
|
|
-
|
|
|
-
|
|
|
"github.com/tal-tech/go-zero/core/conf"
|
|
|
"github.com/tal-tech/go-zero/zrpc"
|
|
|
"google.golang.org/grpc"
|
|
@@ -40,6 +38,7 @@ func main() {
|
|
|
fmt.Printf("Starting rpc server at %s...\n", c.ListenOn)
|
|
|
s.Start()
|
|
|
}
|
|
|
+
|
|
|
//创建orm引擎
|
|
|
func init() {
|
|
|
conf.MustLoad(*configFile, &config.ConfigJson)
|
|
@@ -51,5 +50,7 @@ func init() {
|
|
|
if err != nil {
|
|
|
log.Fatal("数据库连接失败:", err)
|
|
|
}
|
|
|
- fmt.Println(config.ConfigJson.DataSource+"链接成功")
|
|
|
+ service.Engine.SetMaxOpenConns(config.ConfigJson.MaxOpenConns)
|
|
|
+ service.Engine.SetMaxIdleConns(config.ConfigJson.MaxIdleConns)
|
|
|
+ fmt.Println(config.ConfigJson.DataSource + "链接成功")
|
|
|
}
|