servicecontext.go 504 B

12345678910111213141516171819
  1. package svc
  2. import (
  3. "bp.jydev.jianyu360.cn/SocialPlatform/knowledgeBase/api/knowledge/internal/config"
  4. "bp.jydev.jianyu360.cn/SocialPlatform/knowledgeBase/rpc/knowledge/knowledgeclient"
  5. "github.com/zeromicro/go-zero/zrpc"
  6. )
  7. type ServiceContext struct {
  8. Config config.Config
  9. Knowledge knowledgeclient.Knowledge
  10. }
  11. func NewServiceContext(c config.Config) *ServiceContext {
  12. return &ServiceContext{
  13. Config: c,
  14. Knowledge: knowledgeclient.NewKnowledge(zrpc.MustNewClient(c.Knowledge)),
  15. }
  16. }