阿巴阿巴
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"Crimson-Gatekeeper/internal/common"
|
||||
"Crimson-Gatekeeper/internal/database"
|
||||
"Crimson-Gatekeeper/internal/route"
|
||||
"fmt"
|
||||
|
||||
"github.com/go-spring/spring-core/gs"
|
||||
)
|
||||
@@ -11,9 +10,8 @@ import (
|
||||
type Test struct{}
|
||||
|
||||
func main() {
|
||||
gs.Provide(common.GetDataBaseClient)
|
||||
gs.Provide(common.GetQuery)
|
||||
gs.Provide(database.GetDataBaseClient)
|
||||
gs.Provide(database.GetQuery)
|
||||
gs.Provide(route.NewTestBoot).AsRunner()
|
||||
fmt.Println("注入完成")
|
||||
gs.Run()
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package common
|
||||
package database
|
||||
|
||||
import (
|
||||
"Crimson-Gatekeeper/internal/query"
|
||||
@@ -44,7 +44,6 @@ func GetDataBaseClient() *gorm.DB {
|
||||
|
||||
poolCfg.SetConnMaxIdleTime(3)
|
||||
poolCfg.SetMaxOpenConns(10)
|
||||
fmt.Println("构建数据库链接")
|
||||
|
||||
return client
|
||||
}
|
||||
@@ -30,6 +30,6 @@ func (t *TestBoot) Run() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewTestBoot(q *query.Query) *TestBoot {
|
||||
return &TestBoot{q}
|
||||
func NewTestBoot(q []*query.Query) *TestBoot {
|
||||
return &TestBoot{q[0]}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user