ビジネスロジック type EventLogic struct { redis *Redis // Redis構造体を直接参照 } func NewEventLogic(redis *Redis) *EventLogic { return &EventLogic{ redis: redis, } } type (el *EventLogic) Add(ctx context.Context, key string, value string) error { return el.redis.XAdd(ctx, key, value) } type (el *EventLogic) Read(ctx context.Context, key string, id string) (string, error) { return el.redis.ReadMessage(ctx, key, id) } type (el *EventLogic) Acknowledge(ctx context.Context, key string) error { return el.redis.Ack(ctx, key) } 27 既存のコード