Documentation
¶
Overview ¶
Package usecase 는 알림 채널 관리와 발송이다.
Index ¶
- Variables
- type ChannelService
- func (s *ChannelService) Create(ctx context.Context, in CreateChannelInput) (*domain.Channel, error)
- func (s *ChannelService) Delete(ctx context.Context, orgID, id string) error
- func (s *ChannelService) Get(ctx context.Context, orgID, id string) (*domain.Channel, error)
- func (s *ChannelService) List(ctx context.Context, orgID string) ([]*domain.Channel, error)
- func (s *ChannelService) Update(ctx context.Context, orgID, id string, u domain.ChannelUpdate) (*domain.Channel, error)
- type CreateChannelInput
- type Deliverer
- type Dispatcher
- type ListDeliveries
- type SendTest
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrOrgRequired = errors.New("organization is required")
ErrOrgRequired 는 조직 없이 채널을 다루려 한 경우다 — 채널은 조직마다 따로다.
Functions ¶
This section is empty.
Types ¶
type ChannelService ¶
type ChannelService struct {
// contains filtered or unexported fields
}
ChannelService 는 조직의 알림 채널을 만들고 고치고 지운다.
func NewChannelService ¶
func NewChannelService(repo port.ChannelRepository) *ChannelService
func (*ChannelService) Create ¶
func (s *ChannelService) Create(ctx context.Context, in CreateChannelInput) (*domain.Channel, error)
func (*ChannelService) Delete ¶
func (s *ChannelService) Delete(ctx context.Context, orgID, id string) error
type CreateChannelInput ¶
type CreateChannelInput struct {
OrgID string
Name string
Type domain.ChannelType
Settings domain.Settings
Secret string
Events []sharednotify.EventType
Active *bool
}
CreateChannelInput 은 새 채널이다. Active 가 nil 이면 켠다.
type Deliverer ¶
type Deliverer struct {
// contains filtered or unexported fields
}
Deliverer 는 채널 하나로 메시지를 보내고(일시적 실패는 재시도) 결과를 발송 이력에 남긴다.
func NewDeliverer ¶
func NewDeliverer(senders map[domain.ChannelType]port.Sender, deliveries port.DeliveryRepository) *Deliverer
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher 는 생산자의 이벤트를 그 조직의 구독 채널로 보낸다(sharednotify.Publisher).
func NewDispatcher ¶
func NewDispatcher(channels port.ChannelRepository, deliverer *Deliverer) *Dispatcher
func (*Dispatcher) Publish ¶
func (d *Dispatcher) Publish(ctx context.Context, event sharednotify.Event) error
Publish 는 켜져 있고 그 이벤트를 구독한 채널마다 보낸다. 한 채널이 실패해도 나머지는 보내고, 실패를 모아 돌려준다. 구독한 채널이 없으면 할 일이 없다 — 오류가 아니다.
type ListDeliveries ¶
type ListDeliveries struct {
// contains filtered or unexported fields
}
ListDeliveries 는 조직의 최근 발송 이력이다.
func NewListDeliveries ¶
func NewListDeliveries(deliveries port.DeliveryRepository) *ListDeliveries
type SendTest ¶
type SendTest struct {
// contains filtered or unexported fields
}
SendTest 는 채널 설정을 확인하는 테스트 메시지를 보낸다. 꺼진 채널에도 보낸다 — 켜기 전에 확인하는 버튼이다. 결과는 발송 이력에도 남는다.
func NewSendTest ¶
func NewSendTest(channels port.ChannelRepository, deliverer *Deliverer) *SendTest
Click to show internal directories.
Click to hide internal directories.