DI&GIN验证尝试
DI 框架我是没招了,GO 的狗屎接口系统让运行时的DI注入都没办法自动收集接口。 所以...只能捏着鼻子用了。正在想办法解决 GIN 验证框架返回英文的问题
This commit is contained in:
30
srv/cmd/gatekeeper/wire.go
Normal file
30
srv/cmd/gatekeeper/wire.go
Normal file
@@ -0,0 +1,30 @@
|
||||
//go:build wireinject
|
||||
// +build wireinject
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"Crimson-Gatekeeper/internal/application"
|
||||
"Crimson-Gatekeeper/internal/database"
|
||||
"Crimson-Gatekeeper/internal/module/userpak"
|
||||
|
||||
"github.com/google/wire"
|
||||
)
|
||||
|
||||
func getApplication() (*application.Application, error) {
|
||||
wire.Build(
|
||||
CtrlCollector,
|
||||
application.NewApplication,
|
||||
database.GetDataBaseClient,
|
||||
database.GetQuery,
|
||||
database.GetPoolCfg,
|
||||
userpak.NewUserCtl,
|
||||
)
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func CtrlCollector(
|
||||
c1 *userpak.UserCtl,
|
||||
) []application.Ctrl {
|
||||
return []application.Ctrl{c1}
|
||||
}
|
||||
Reference in New Issue
Block a user