service_context.go 342 B

12345678910111213141516171819
  1. package svc
  2. import (
  3. "call_center/db/api/internal/config"
  4. "call_center/db/rpc/db"
  5. "github.com/tal-tech/go-zero/zrpc"
  6. )
  7. type ServiceContext struct {
  8. Config config.Config
  9. DbRpc db.Db
  10. }
  11. func NewServiceContext(c config.Config) *ServiceContext {
  12. return &ServiceContext{
  13. Config: c,
  14. DbRpc: db.NewDb(zrpc.MustNewClient(c.DbRpc)),
  15. }
  16. }