123456789101112131415161718192021222324 |
- package svc
- import (
- "GtDataStore/app/cmd/events/internal/config"
- "github.com/go-redis/redis/v8"
- )
- type ServiceContext struct {
- Config config.Config
- Cache *redis.Client
- modelList
- }
- func NewServiceContext(c config.Config) *ServiceContext {
- svc := &ServiceContext{
- Config: c,
- Cache: redis.NewClient(&redis.Options{Addr: c.Cache[0].Host, Password: c.Cache[0].Pass, MaxRetries: 5}),
- }
- initModel(svc)
- return svc
- }
|