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