servicecontext.go 325 B

123456789101112131415161718
  1. package svc
  2. import (
  3. "github.com/zeromicro/go-zero/core/stores/redis"
  4. "self-im-rtc/internal/config"
  5. )
  6. type ServiceContext struct {
  7. Config config.Config
  8. Redis *redis.Redis
  9. }
  10. func NewServiceContext(c config.Config) *ServiceContext {
  11. return &ServiceContext{
  12. Config: c,
  13. Redis: redis.MustNewRedis(c.RedisConf),
  14. }
  15. }