22 lines
382 B
Go
22 lines
382 B
Go
package svc
|
|
|
|
import (
|
|
"godemo/gateway/internal/config"
|
|
"godemo/user/user"
|
|
|
|
"github.com/zeromicro/go-zero/zrpc"
|
|
)
|
|
|
|
type ServiceContext struct {
|
|
Config config.Config
|
|
UserRpc user.UserClient
|
|
}
|
|
|
|
func NewServiceContext(c config.Config) *ServiceContext {
|
|
conn := zrpc.MustNewClient(c.UserRpc).Conn()
|
|
return &ServiceContext{
|
|
Config: c,
|
|
UserRpc: user.NewUserClient(conn),
|
|
}
|
|
}
|