实现category service基础接口

This commit is contained in:
2025-05-31 16:27:01 +08:00
parent faa6a35475
commit e5446bf836
33 changed files with 1420 additions and 67 deletions

View File

@ -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()),
}
}