实现category service基础接口
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package svc
|
||||
|
||||
import (
|
||||
"godemo/category/category"
|
||||
"godemo/gateway/internal/config"
|
||||
"godemo/user/user"
|
||||
|
||||
@ -8,14 +9,15 @@ import (
|
||||
)
|
||||
|
||||
type ServiceContext struct {
|
||||
Config config.Config
|
||||
UserRpc user.UserClient
|
||||
Config config.Config
|
||||
UserRpc user.UserClient
|
||||
CategoryRpc category.CategoryClient
|
||||
}
|
||||
|
||||
func NewServiceContext(c config.Config) *ServiceContext {
|
||||
conn := zrpc.MustNewClient(c.UserRpc).Conn()
|
||||
return &ServiceContext{
|
||||
Config: c,
|
||||
UserRpc: user.NewUserClient(conn),
|
||||
Config: c,
|
||||
UserRpc: user.NewUserClient(zrpc.MustNewClient(c.UserRpc).Conn()),
|
||||
CategoryRpc: category.NewCategoryClient(zrpc.MustNewClient(c.CategoryRpc).Conn()),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user